diff --git a/arch/arm/src/stm32/stm32_can_sock.c b/arch/arm/src/stm32/stm32_can_sock.c index dc667f3393..f51f9b8ea0 100644 --- a/arch/arm/src/stm32/stm32_can_sock.c +++ b/arch/arm/src/stm32/stm32_can_sock.c @@ -881,7 +881,7 @@ static int stm32can_transmit(struct stm32_can_s *priv) regval &= ~CAN_TIR_EXID_MASK; if (frame->can_id & CAN_EFF_FLAG) { - DEBUGASSERT(frame->can_id < (1 << 29)); + DEBUGASSERT((frame->can_id ^ CAN_EFF_FLAG) < (1 << 29)); regval |= (frame->can_id << CAN_TIR_EXID_SHIFT) | CAN_TIR_IDE; } else diff --git a/arch/arm/src/stm32/stm32_fdcan_sock.c b/arch/arm/src/stm32/stm32_fdcan_sock.c index 073fa2c48e..694ef6cd4a 100644 --- a/arch/arm/src/stm32/stm32_fdcan_sock.c +++ b/arch/arm/src/stm32/stm32_fdcan_sock.c @@ -1682,7 +1682,7 @@ static int fdcan_send(struct stm32_fdcan_s *priv) #ifdef CONFIG_NET_CAN_EXTID if ((frame->can_id & CAN_EFF_FLAG) != 0) { - DEBUGASSERT(frame->can_id < (1 << 29)); + DEBUGASSERT((frame->can_id ^ CAN_EFF_FLAG) < (1 << 29)); txbuffer[0] |= BUFFER_R0_EXTID(frame->can_id) | BUFFER_R0_XTD; } diff --git a/arch/arm/src/stm32f7/stm32_can_sock.c b/arch/arm/src/stm32f7/stm32_can_sock.c index 2cc3960b24..34141f7602 100644 --- a/arch/arm/src/stm32f7/stm32_can_sock.c +++ b/arch/arm/src/stm32f7/stm32_can_sock.c @@ -905,7 +905,7 @@ static int stm32can_transmit(struct stm32_can_s *priv) regval &= ~CAN_TIR_EXID_MASK; if (frame->can_id & CAN_EFF_FLAG) { - DEBUGASSERT(frame->can_id < (1 << 29)); + DEBUGASSERT((frame->can_id ^ CAN_EFF_FLAG) < (1 << 29)); regval |= (frame->can_id << CAN_TIR_EXID_SHIFT) | CAN_TIR_IDE; } else