Skip to contentSkip to conversation

Patch "can: ti_hecc: fix -Woverflow compiler warning" has been added to the 6.15-stable tree

DISCUSSION Vincent Mailhol 2 participants 2 messages Aug 18, 2025 – Aug 22, 2025 1 message not in the archive Stable branch

lore
Share & tools
lore
#1 lore raw
In reply to a message not in the archive

Hi Sasha,

Quoted 8 lines · Sasha Levin

This is a note to let you know that I've just added the patch titled

can: ti_hecc: fix -Woverflow compiler warning

to the 6.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 6 lines

The filename of the patch is:
can-ti_hecc-fix-woverflow-compiler-warning.patch
and it can be found in the queue-6.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

This only silences a compiler warning. There are no actual bugs in the original code. This is why I did not put the Fixes tag.

I am not against this being backported to stable but please note that this depends on the new BIT_U32() macro which where recently added in commit 5b572e8a9f3d ("bits: introduce fixed-type BIT_U*()")

So, unless you also backport the above patch, this will not compile.

The options are:

1. drop this patch (i.e. keep that benin -Woverflow in stable)
2. backport the new BIT_U*() macros and keep the patch as-is
3. modify the patch as below:

       mbx_mask = ~(u32)BIT(HECC_RX_LAST_MBOX);

I'll let you decide what you prefer. That comment also applies to the other backports of that patch except for the 6.16.x branch which already has the BIT_U*() macros.

Yours sincerely,
Vincent Mailhol

Quoted 33 lines

commit f37dbcbbea3844900081b44f372f2f4d4be1b5c6

Author: Vincent Mailhol <[email protected]>
Date:   Tue Jul 15 20:28:11 2025 +0900

can: ti_hecc: fix -Woverflow compiler warning

[ Upstream commit 7cae4d04717b002cffe41169da3f239c845a0723 ]

Fix below default (W=0) warning:

drivers/net/can/ti_hecc.c: In function 'ti_hecc_start':
drivers/net/can/ti_hecc.c:386:20: warning: conversion from 'long unsigned int' to 'u32' {aka 'unsigned int'} changes value from '18446744073709551599' to '4294967279' [-Woverflow]
386 | mbx_mask = ~BIT(HECC_RX_LAST_MBOX);
| ^

drivers/net/can/ti_hecc.c +1 -1
index 644e8b8eb91e..e6d6661a908a 100644
@@ -383,7 +383,7 @@ static void ti_hecc_start(struct net_device *ndev)
         * overflows instead of the hardware silently dropping the
         * messages.
         */
-       mbx_mask = ~BIT(HECC_RX_LAST_MBOX);
+       mbx_mask = ~BIT_U32(HECC_RX_LAST_MBOX);
        hecc_write(priv, HECC_CANOPC, mbx_mask);
 
        /* Enable interrupts */
#2 lore raw
Quoted 34 lines · Vincent Mailhol

Hi Sasha,

Quoted 8 lines · Sasha Levin

This is a note to let you know that I've just added the patch titled

can: ti_hecc: fix -Woverflow compiler warning

to the 6.15-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

Quoted 6 lines

The filename of the patch is:
can-ti_hecc-fix-woverflow-compiler-warning.patch
and it can be found in the queue-6.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

This only silences a compiler warning. There are no actual bugs in the original code. This is why I did not put the Fixes tag.

I am not against this being backported to stable but please note that this depends on the new BIT_U32() macro which where recently added in commit 5b572e8a9f3d ("bits: introduce fixed-type BIT_U*()")

So, unless you also backport the above patch, this will not compile.

The options are:

1. drop this patch (i.e. keep that benin -Woverflow in stable)
2. backport the new BIT_U*() macros and keep the patch as-is
3. modify the patch as below:

Quoted 5 lines
       mbx_mask = ~(u32)BIT(HECC_RX_LAST_MBOX);

I'll let you decide what you prefer. That comment also applies to the other backports of that patch except for the 6.16.x branch which already has the BIT_U*() macros.

Oops, missed this, it broke the build, as you point out, so I'll go drop it from all older kernels and revert it in 6.12.y now.

thanks,

greg k-h