lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5.10 424/530] cxgb4: Fix unintentional sign extension issues
Hi!

> From: Colin Ian King <colin.king@canonical.com>

> The shifting of the u8 integers f->fs.nat_lip[] by 24 bits to
> the left will be promoted to a 32 bit signed int and then
> sign-extended to a u64. In the event that the top bit of the u8
> is set then all then all the upper 32 bits of the u64 end up as
> also being set because of the sign-extension. Fix this by
> casting the u8 values to a u64 before the 24 bit left shift.

Should we really use -stable series for beta-testing patches going to
-rc1? Because that's what Sasha is effectively doing.

> Addresses-Coverity: ("Unintended sign extension")
> Fixes: 12b276fbf6e0 ("cxgb4: add support to create hash filters")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> Signed-off-by: Sasha Levin <sashal@kernel.org>

> set_tcb_field(adap, f, tid, TCB_RX_FRAG3_LEN_RAW_W,
> WORD_MASK, f->fs.nat_lip[3] |
> f->fs.nat_lip[2] << 8 |
> f->fs.nat_lip[1] << 16 |
> - f->fs.nat_lip[0] << 24, 1);
> + (u64)f->fs.nat_lip[0] << 25, 1);
> }
> }


This one is wrong.

Best regards,
Pavel
--
http://www.livejournal.com/~pavelmachek
[unhandled content-type:application/pgp-signature]
\
 
 \ /
  Last update: 2021-05-14 11:35    [W:1.612 / U:0.132 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site