diff options
author | Yu-Chun Lin <eleanor15x@gmail.com> | 2025-02-18 16:12:16 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-03-22 12:54:19 -0700 |
commit | 94e7476fa7c5412c67a7cb5feb8b8180f69f09f7 (patch) | |
tree | 2bf4a6f7ba017fe5d7889b3474aeb557d941b0a4 /rust/kernel/task.rs | |
parent | 7ece63c977c11979007c2b65b3cc4bb6eabc1aab (diff) |
sctp: Fix undefined behavior in left shift operation
[ Upstream commit 606572eb22c1786a3957d24307f5760bb058ca19 ]
According to the C11 standard (ISO/IEC 9899:2011, 6.5.7):
"If E1 has a signed type and E1 x 2^E2 is not representable in the result
type, the behavior is undefined."
Shifting 1 << 31 causes signed integer overflow, which leads to undefined
behavior.
Fix this by explicitly using '1U << 31' to ensure the shift operates on
an unsigned type, avoiding undefined behavior.
Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Link: https://patch.msgid.link/20250218081217.3468369-1-eleanor15x@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'rust/kernel/task.rs')
0 files changed, 0 insertions, 0 deletions