Thread (2 messages) flat view 2 messages, 1 author, 2021-03-29

RE: [PATCH net] enetc: Avoid implicit sign extension

From: Claudiu Manoil <claudiu.manoil@nxp.com>
Date: 2021-03-29 13:54:06

-----Original Message-----
From: Claudiu Manoil <claudiu.manoil@nxp.com>
Sent: Monday, March 29, 2021 4:35 PM
To: netdev@vger.kernel.org
Cc: Jakub Kicinski <kuba@kernel.org>; David S . Miller
[off-list ref]; Vladimir Oltean [off-list ref]
Subject: [PATCH net] enetc: Avoid implicit sign extension

Static analysis tool reports:
"Suspicious implicit sign extension - 'flags' with type u8 (8 bit,
unsigned) is promoted in 'flags' << 24 to type int (32 bits, signed),
then sign-extended to type unsigned long long (64 bits, unsigned).
If flags << 24 is greater than 0x7FFFFFFF, the upper bits of the result
will all be 1."

Use lower_32_bits() to avoid this scenario.
Fixes: 82728b91f124 ("enetc: Remove Tx checksumming offload code")
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help