[PATCH v2 0/4 5.10.y] overflow: Allow mixed type arguments in overflow macros

Eliav Farber posted 4 patches 2 weeks, 6 days ago
There is a newer version of this series
include/linux/compiler-clang.h     |  13 --
include/linux/compiler-gcc.h       |   4 -
include/linux/compiler.h           |   6 +
include/linux/overflow.h           | 209 ++++++-----------------------
include/linux/trace_events.h       |   2 -
tools/include/linux/compiler-gcc.h |   4 -
tools/include/linux/overflow.h     | 140 +------------------
7 files changed, 52 insertions(+), 326 deletions(-)
[PATCH v2 0/4 5.10.y] overflow: Allow mixed type arguments in overflow macros
Posted by Eliav Farber 2 weeks, 6 days ago
This series backports four commits to bring include/linux/overflow.h in
line with v5.15.193:
 - 2541be80b1a2 ("overflow: Correct check_shl_overflow() comment")
 - 564e84663d25 ("compiler.h: drop fallback overflow checkers")
 - 1d1ac8244c22 ("overflow: Allow mixed type arguments")
 - f96cfe3e05b0 ("tracing: Define the is_signed_type() macro once")

The motivation is to fix build failures such as:

drivers/net/ethernet/intel/e1000e/ethtool.c: In function ‘e1000_set_eeprom’:
./include/linux/overflow.h:71:15: error: comparison of distinct pointer types lacks a cast [-Werror]
   71 |  (void) (&__a == __d);   \
      |               ^~
drivers/net/ethernet/intel/e1000e/ethtool.c:582:6: note: in expansion of macro ‘check_add_overflow’
  582 |  if (check_add_overflow(eeprom->offset, eeprom->len, &total_len) ||
      |      ^~~~~~~~~~~~~~~~~~

This regression was triggered by commit ce8829d3d44b ("e1000e: fix heap
overflow in e1000_set_eeprom").

check_add_overflow() requires the first two operands and the result
pointer to be of identical type. On 64-bit builds, using size_t for the
result conflicted with the u32 fields eeprom->offset and eeprom->len,
resulting in type check failures.

BarteVan Assche (1):
  tracing: Define the is_signed_type() macro once

Kees Cook (1):
  overflow: Allow mixed type arguments

Keith Busch (1):
  overflow: Correct check_shl_overflow() comment

Nick Desaulniers (1):
  compiler.h: drop fallback overflow checkers

 include/linux/compiler-clang.h     |  13 --
 include/linux/compiler-gcc.h       |   4 -
 include/linux/compiler.h           |   6 +
 include/linux/overflow.h           | 209 ++++++-----------------------
 include/linux/trace_events.h       |   2 -
 tools/include/linux/compiler-gcc.h |   4 -
 tools/include/linux/overflow.h     | 140 +------------------
 7 files changed, 52 insertions(+), 326 deletions(-)

---
Changes in v2:
 - Added missing sign-off in all patches

-- 
2.47.3

Re: [PATCH v2 0/4 5.10.y] overflow: Allow mixed type arguments in overflow macros
Posted by Sasha Levin 2 weeks, 5 days ago
On Fri, Sep 12, 2025 at 03:30:34PM +0000, Eliav Farber wrote:
>This series backports four commits to bring include/linux/overflow.h in
>line with v5.15.193:
> - 2541be80b1a2 ("overflow: Correct check_shl_overflow() comment")
> - 564e84663d25 ("compiler.h: drop fallback overflow checkers")
> - 1d1ac8244c22 ("overflow: Allow mixed type arguments")
> - f96cfe3e05b0 ("tracing: Define the is_signed_type() macro once")

None of these SHA1s match with what's actually in v5.15.193. What's going on
here?

-- 
Thanks,
Sasha
RE: [PATCH v2 0/4 5.10.y] overflow: Allow mixed type arguments in overflow macros
Posted by Farber, Eliav 2 weeks, 5 days ago
> On Fri, Sep 12, 2025 at 03:30:34PM +0000, Eliav Farber wrote:
> >This series backports four commits to bring include/linux/overflow.h in 
> >line with v5.15.193:
> > - 2541be80b1a2 ("overflow: Correct check_shl_overflow() comment")
> > - 564e84663d25 ("compiler.h: drop fallback overflow checkers")
> > - 1d1ac8244c22 ("overflow: Allow mixed type arguments")
> > - f96cfe3e05b0 ("tracing: Define the is_signed_type() macro once")
>
> None of these SHA1s match with what's actually in v5.15.193. What's going on here?
Fixed in v3.

---
Thanks, Eliav
Re: [PATCH v2 0/4 5.10.y] overflow: Allow mixed type arguments in overflow macros
Posted by Bart Van Assche 2 weeks, 6 days ago
On 9/12/25 8:30 AM, Eliav Farber wrote:
> BarteVan Assche (1):

Please spell my name correctly in future emails.

Thanks,

Bart.