Skip to content

lib/bch: fix undefined behavior from signed left-shifts

Josh Law lkml 1 version Applied

Status from this message: [merged mm-nonmm-stable] lib-bch-fix-signed-shift-overflow-in-build_mod8_tables.patch removed from -mm tree

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 0 repliesApplied 2/2

Patches in v1 All 2 applied

#Subject and filesSizeRepliesApplied
1/2lib/bch: fix signed left-shift undefined behaviorlib/bch.c+2 -20 repliesApplied
2/2lib/bch: fix signed shift overflow in build_mod8_tableslib/bch.c+1 -10 repliesApplied

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] lib/bch: fix undefined behavior from signed left-shifts

Fix two instances of undefined behavior in lib/bch.c caused by left-shifting signed integers into or past the sign bit.

While the kernel's -fno-strict-overflow flag prevents miscompilation today, these are formally UB per C11 6.5.7p4 and trivial to fix.

Josh Law (2):
lib/bch: fix signed left-shift undefined behavior lib/bch: fix signed shift overflow in build_mod8_tables

 lib/bch.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.34.1