diff options
| author | Yu-Chun Lin <[email protected]> | 2025-02-18 08:12:16 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-02-20 02:55:40 +0000 |
| commit | 606572eb22c1786a3957d24307f5760bb058ca19 (patch) | |
| tree | c61110f96d6b6dfb859ee15107392b9ae8807664 /net/ipv4/tcp_input.c | |
| parent | Merge branch 'flow_dissector-fix-handling-of-mixed-port-and-port-range-keys' (diff) | |
| download | kernel-606572eb22c1786a3957d24307f5760bb058ca19.tar.gz kernel-606572eb22c1786a3957d24307f5760bb058ca19.zip | |
sctp: Fix undefined behavior in left shift operation
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 <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'net/ipv4/tcp_input.c')
0 files changed, 0 insertions, 0 deletions
