Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp502728pxj; Fri, 14 May 2021 08:36:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIaqpHQ17w3qz0w58UZb7kYQr/HbHLGy6fxABZFe3VMDx0h+R7Q7nLhbkgpkN7QPAbLXV0 X-Received: by 2002:a17:906:5917:: with SMTP id h23mr9071760ejq.457.1621006617242; Fri, 14 May 2021 08:36:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621006617; cv=none; d=google.com; s=arc-20160816; b=zAeGZTzmZ+3NRql7rgTi6qL/zYuFqQUrmTNjwM4QEMCwe0D+vO27XHTN4cO6t9fAOq 7mLvRfAfKtvaU7AP4ZW60U7ky8147pJGb8IKI4ce5KH8GvVu81OQDscWETizsolTMac+ 7TtBW6VMtZU0yiZvRooXvOFIfKhlL9bp/lGYYh+cDqeptjPTr7ZRr2vRVODxsjN8+EBz IXlvgx1p98ju70H2xcRX1wqKcn0wHJjR5BF/ZX/6RloTLbH2yxJV48q4Idjkn7zg7j5F eK067xkgN4DjL/X9yQLVll2AVysSsZqtoMXVNdl1dtVm8bne+x7IliEVV62WlmEoBLnz ofMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=SQmjPpwh2qW/Vcp/qahPPPkb8AXoEnteVO7dr9gY/Fc=; b=KbXwLK/OPWwStCecqXEEjaEWxBdWlcK5SoisSEyhu2Igyx81qgnfvfJazDQg8REXaX RHs4Ah9F0GZghwbRDZL++7ubMWMv19x/C2yuT/VC0UvYuwemD0GAIbxq05bdDw5BMobW KsiGpCwS8RDU5ndKvKsmPQmNh+aKw6z7qFDggghpt7FmGFRV4rWgyeAa24WwFWmkgx1r MwZeHECY1Wmbh4W+Y6j9X/Xos5ER7OFAnP6c2hzXHVDCITjkzAseiWGn+lupPAMKiw4X 0IZmSu/aGlQ81fELJljzmaUPhcvcCL8wYnYkwjDxMeVZXpBA4vTJgnDHt3rkGgZ5cZaW stDw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k20si2545567ejj.671.2021.05.14.08.36.31; Fri, 14 May 2021 08:36:57 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233915AbhENJfw (ORCPT + 99 others); Fri, 14 May 2021 05:35:52 -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--