Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

lib/bch: fix signed shift overflow in build_mod8_tables

Cast loop variable to unsigned int before left-shifting to avoid undefined
behavior when i >= 128 and b == 3 (i << 24 overflows signed int).

Link: https://lkml.kernel.org/r/20260318074806.16527-3-objecting@objecting.org
Signed-off-by: Josh Law <objecting@objecting.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Cc: Ivan Djelic <ivan.djelic@parrot.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Josh Law and committed by
Andrew Morton
010d7d98 f42b5109

+1 -1
+1 -1
lib/bch.c
··· 1116 1116 for (b = 0; b < 4; b++) { 1117 1117 /* we want to compute (p(X).X^(8*b+deg(g))) mod g(X) */ 1118 1118 tab = bch->mod8_tab + (b*256+i)*l; 1119 - data = i << (8*b); 1119 + data = (unsigned int)i << (8*b); 1120 1120 while (data) { 1121 1121 d = deg(data); 1122 1122 /* subtract X^d.g(X) from p(X).X^(8*b+deg(g)) */