Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp10988ybt; Tue, 7 Jul 2020 14:35:13 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxE8hZIDprhGXVl+Q0havLGru7VYabtpbSts6vAFAU710/ipT68g4Xv2ca4o48WWsuClN0 X-Received: by 2002:aa7:cfc4:: with SMTP id r4mr28587521edy.22.1594157713298; Tue, 07 Jul 2020 14:35:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594157713; cv=none; d=google.com; s=arc-20160816; b=vUAY6CTNMcZ4wcaEC++RomwiyuvRLiR5sfZoTDOfqZ9cbvAdOOuPwlVHXOBf7e+9qn q83dGMqncJLiPDPrkZ5ZazwkejeFAvvugx8Ai/Z0xtkAzPNrBBAT7z2u/X1R7wYAaTqx iYMk52SeF68ycdUTsxEScZBs6uOFD0Blzk0dVc+/6e+3sHvuu7LPK4fVMjHnIr/VY/5d HSuE4uagclc+ACGg7EoA8yueDoMkzZE3coY5Nrorn1ub2UF+Y1qdcSgNnFp89riXMchB 7CSOgSSzQKFYpAhA2x3XaG+Tq4FQUIK1+Nk5W3c8UyWtcBlzczZWMXWSZxoVHDqWmIGg RD6A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=txCF6yXWojYcs200ty49XNUxgM4DQ3YvW6DjGiQ2DbI=; b=PPeu45blK1r2q0BbgM5Ai3mOFpuVnrhj5jRWtMOoslIacpOT555IFavlVHauo4Rt6f X8YDcyel13tE9bpovg9zSRrgsT/A/0DU8IEoe2g+bji5DnFBcUqCRpObZox0yUYU2DG8 PuRW3c1Wi9d2Emdu/TZiNq6f7jLK2111cEcnNwDLiP8e4zs3O6MSmcxxMJkXWRnY51KP RlwdgwTlWPGZEl09H3NnOS0ZlkF1L2c0mUuYN+unwduR+HMSoTSFvWJuE0pogcJU+3WI Jdf6cbZ8yGqiohA916QsjSAtRczlc/kUNrtkc1RCLtlu7/iK0MhgESmhdGGO+VCtMUB3 Vv8A== 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 gz26si15174667ejb.651.2020.07.07.14.34.50; Tue, 07 Jul 2020 14:35:13 -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 S1728806AbgGGVda (ORCPT + 99 others); Tue, 7 Jul 2020 17:33:30 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:35118 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728296AbgGGVd3 (ORCPT ); Tue, 7 Jul 2020 17:33:29 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 39D6A1C0C0A; Tue, 7 Jul 2020 23:33:27 +0200 (CEST) Date: Tue, 7 Jul 2020 23:33:26 +0200 From: Pavel Machek To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org, Rahul Lakkireddy , "David S. Miller" , Sasha Levin Subject: Re: [PATCH 4.19 17/36] cxgb4: use correct type for all-mask IP address comparison Message-ID: <20200707213326.GB11158@amd> References: <20200707145749.130272978@linuxfoundation.org> <20200707145749.959174058@linuxfoundation.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bn2rw/3z4jIqBvZU" Content-Disposition: inline In-Reply-To: <20200707145749.959174058@linuxfoundation.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Bn2rw/3z4jIqBvZU Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > From: Rahul Lakkireddy >=20 > [ Upstream commit f286dd8eaad5a2758750f407ab079298e0bcc8a5 ] >=20 > Use correct type to check for all-mask exact match IP addresses. >=20 > Fixes following sparse warnings due to big endian value checks > against 0xffffffff in is_addr_all_mask(): > cxgb4_filter.c:977:25: warning: restricted __be32 degrades to integer > cxgb4_filter.c:983:37: warning: restricted __be32 degrades to integer > cxgb4_filter.c:984:37: warning: restricted __be32 degrades to integer > cxgb4_filter.c:985:37: warning: restricted __be32 degrades to integer > cxgb4_filter.c:986:37: warning: restricted __be32 degrades to integer > diff --git a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c b/drivers/= net/ethernet/chelsio/cxgb4/cxgb4_filter.c > index 7dddb9e748b81..86745f33a252d 100644 > --- a/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c > +++ b/drivers/net/ethernet/chelsio/cxgb4/cxgb4_filter.c > @@ -810,16 +810,16 @@ static bool is_addr_all_mask(u8 *ipmask, int family) > struct in_addr *addr; > =20 > addr =3D (struct in_addr *)ipmask; > - if (addr->s_addr =3D=3D 0xffffffff) > + if (ntohl(addr->s_addr) =3D=3D 0xffffffff) Endianity does not really matter for ~0, but can compiler figure it out? would it be better to do these tests as=20 if (foo =3D=3D htonl(0xffffffff)) to make it clear to the compiler? Thanks, Pavel > } else if (family =3D=3D AF_INET6) { > struct in6_addr *addr6; > =20 > addr6 =3D (struct in6_addr *)ipmask; > - if (addr6->s6_addr32[0] =3D=3D 0xffffffff && > - addr6->s6_addr32[1] =3D=3D 0xffffffff && > - addr6->s6_addr32[2] =3D=3D 0xffffffff && > - addr6->s6_addr32[3] =3D=3D 0xffffffff) > + if (ntohl(addr6->s6_addr32[0]) =3D=3D 0xffffffff && > + ntohl(addr6->s6_addr32[1]) =3D=3D 0xffffffff && > + ntohl(addr6->s6_addr32[2]) =3D=3D 0xffffffff && > + ntohl(addr6->s6_addr32[3]) =3D=3D 0xffffffff) > return true; > } > return false; --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --Bn2rw/3z4jIqBvZU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAl8E6iYACgkQMOfwapXb+vJLpACdEj/Y83rAxd9brW1nECrg00xp ZhIAn1OLUasoKxmEd9olKPWbXPxy/3UR =t1HC -----END PGP SIGNATURE----- --Bn2rw/3z4jIqBvZU--