android_kernel_motorola_sm6375/kernel/printk
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Kuan-Wei Chiu 54c14022fa printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX
[ Upstream commit 3d6f83df8ff2d5de84b50377e4f0d45e25311c7a ]

Shifting 1 << 31 on a 32-bit int causes signed integer overflow, which
leads to undefined behavior. To prevent this, cast 1 to u32 before
performing the shift, ensuring well-defined behavior.

This change explicitly avoids any potential overflow by ensuring that
the shift occurs on an unsigned 32-bit integer.

Signed-off-by: Kuan-Wei Chiu <[email protected]>
Acked-by: Petr Mladek <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Petr Mladek <[email protected]>
Signed-off-by: Sasha Levin <[email protected]>
2025-03-13 12:43:02 +01:00
..
braille.c
braille.h
console_cmdline.h
internal.h
Makefile
printk.c printk: Fix signed integer overflow when defining LOG_BUF_LEN_MAX 2025-03-13 12:43:02 +01:00
printk_safe.c