From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EA16BC433ED for ; Fri, 14 May 2021 09:34:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8BF961415 for ; Fri, 14 May 2021 09:34:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233922AbhENJfx (ORCPT ); Fri, 14 May 2021 05:35:53 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:45722 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230440AbhENJfw (ORCPT ); Fri, 14 May 2021 05:35:52 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 35E321C0B81; Fri, 14 May 2021 11:34:40 +0200 (CEST) Date: Fri, 14 May 2021 11:34:39 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Colin Ian King , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 5.10 424/530] cxgb4: Fix unintentional sign extension issues Message-ID: <20210514093439.GA12797@amd> References: <20210512144819.664462530@linuxfoundation.org> <20210512144833.706658184@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="SLDf9lqlvOQaIe6s" Content-Disposition: inline In-Reply-To: <20210512144833.706658184@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --SLDf9lqlvOQaIe6s Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Colin Ian King > 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 > Signed-off-by: David S. Miller > Signed-off-by: Sasha Levin > 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 --=20 http://www.livejournal.com/~pavelmachek --SLDf9lqlvOQaIe6s Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAmCeRC8ACgkQMOfwapXb+vLxUwCghjQthRJh+KTYoRApzGRY5U+0 6HkAnRcrRBcACVCxgEGLgIilqrrOxuwe =vJ6O -----END PGP SIGNATURE----- --SLDf9lqlvOQaIe6s--