From c1c5d8d611fbeb55785d014cc39d0e3559a82ae7 Mon Sep 17 00:00:00 2001 From: raiden00pl Date: Mon, 7 Oct 2024 11:49:12 +0200 Subject: [PATCH] arch/arm/stm32{|f7}/socketcan: fix debugassert for extid frames fix debugassert for extid frames, we have to remove CAN_EFF_FLAG bit from the expression --- arch/arm/src/stm32/stm32_can_sock.c | 2 +- arch/arm/src/stm32/stm32_fdcan_sock.c | 2 +- arch/arm/src/stm32f7/stm32_can_sock.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) 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