[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210514093439.GA12797@amd>
Date: Fri, 14 May 2021 11:34:39 +0200
From: Pavel Machek <pavel@....cz>
To: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Colin Ian King <colin.king@...onical.com>,
"David S. Miller" <davem@...emloft.net>,
Sasha Levin <sashal@...nel.org>
Subject: Re: [PATCH 5.10 424/530] cxgb4: Fix unintentional sign extension
issues
Hi!
> From: Colin Ian King <colin.king@...onical.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@...onical.com>
> Signed-off-by: David S. Miller <davem@...emloft.net>
> Signed-off-by: Sasha Levin <sashal@...nel.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
Download attachment "signature.asc" of type "application/pgp-signature" (182 bytes)
Powered by blists - more mailing lists