Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp496268pxb; Wed, 6 Oct 2021 09:15:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw75s8AiLpULZIYr//cUdggE/p+tUBnVjpkd6p3NC5wGtZMKSd5LpGAvmhJdJ/SqoCVLXpH X-Received: by 2002:a62:4d42:0:b0:44b:3078:7387 with SMTP id a63-20020a624d42000000b0044b30787387mr37604861pfb.27.1633536946324; Wed, 06 Oct 2021 09:15:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633536946; cv=none; d=google.com; s=arc-20160816; b=CazSdBwScmnyHy1DFf3M5nuXXsRfDqyaAneM52jIoCnivguKgE5rArXzGYN5gti7pi 8beFbF4E1ZEd8hYXG1uKGzpS/37eSqfOqZtiZyOnAe/7aFh3s7AYjvLUHMdio4tF2uDj Ypt/sb6CfEiHEF6zXREMzFIO5C9oYcvruzwoWf2vbrvVERg397NUmbK6govKn6pXGnE0 lNhCvYpOmBXDd+sW86z/0kW1zHyUrz4Jhce0+0HfYyQrtCwvAj9wkY0uB1JTR541rko+ 6aT2JlWpankfVcR7qTmma6kEEZf75y1u1cvPQd4U4I65zRYdquo42kqPAdYNX0wntD+D Ww3A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :subject:cc:to:from:date; bh=TA+OrQsDEOdbTzHJ5D9AKumTHntWMi7dzEW7mUt/Cr0=; b=B+s36qzayydSN7BfdFQGsmXTFveXPn+16gCGav15e+Sz06oovS9fuft1cG2kehXpqE SGQhFr4c5Ueec5BJSZanjcq1KedStDvAPiGHTRVJNeB4XQ+WlcPX19aD10gTAP9LRhpf xCTakLHT5wu9BZ5l6hDIBUfn0axlAG0KKr4HjRkKYMNA84UNY+32w0wYWKH02XMBrKSa u4bvjYAQJjOTDRSAiBLSQcbMqVxcZAxREKdTdMvETZqJqVB+diR65QwpZ0CMDbwbZAYJ rZVW24TTwSJeKHHy74ME6rrunDVei/qFGdX9VaPFjp+S4X1VDzbEisXWjikSJK6GiCRi h8mA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-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 h193si2268137pgc.395.2021.10.06.09.15.24; Wed, 06 Oct 2021 09:15:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-wireless-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-wireless-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-wireless-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239342AbhJFQQl (ORCPT + 75 others); Wed, 6 Oct 2021 12:16:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231768AbhJFQQk (ORCPT ); Wed, 6 Oct 2021 12:16:40 -0400 Received: from bues.ch (bues.ch [IPv6:2a01:138:9005::1:4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 22AE3C061746 for ; Wed, 6 Oct 2021 09:14:48 -0700 (PDT) Received: by bues.ch with esmtpsa (Exim 4.92) (envelope-from ) id 1mY9Z1-0002Y7-Es; Wed, 06 Oct 2021 18:14:39 +0200 Date: Wed, 6 Oct 2021 18:13:34 +0200 From: Michael =?UTF-8?B?QsO8c2No?= To: Dan Carpenter Cc: Kalle Valo , kernel-janitors@vger.kernel.org, linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org Subject: Re: [PATCH 2/2] b43: fix a lower bounds test Message-ID: <20211006181334.621ac10c@wiggum> In-Reply-To: <20211006073621.GE8404@kili> References: <20211006073542.GD8404@kili> <20211006073621.GE8404@kili> X-Mailer: Claws Mail 3.18.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/QqtpiT/CB7f5fqDpH1ja61U"; protocol="application/pgp-signature"; micalg=pgp-sha512 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --Sig_/QqtpiT/CB7f5fqDpH1ja61U Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 6 Oct 2021 10:36:22 +0300 Dan Carpenter wrote: > The problem is that "channel" is an unsigned int, when it's less 5 the > value of "channel - 5" is not a negative number as one would expect but > is very high positive value instead. >=20 > This means that "start" becomes a very high positive value. The result > of that is that we never enter the "for (i =3D start; i <=3D end; i++) {" > loop. Instead of storing the result from b43legacy_radio_aci_detect() > it just uses zero. >=20 > Fixes: ef1a628d83fc ("b43: Implement dynamic PHY API") > Signed-off-by: Dan Carpenter > --- > drivers/net/wireless/broadcom/b43/phy_g.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/net/wireless/broadcom/b43/phy_g.c b/drivers/net/wire= less/broadcom/b43/phy_g.c > index d5a1a5c58236..ac72ca39e409 100644 > --- a/drivers/net/wireless/broadcom/b43/phy_g.c > +++ b/drivers/net/wireless/broadcom/b43/phy_g.c > @@ -2297,7 +2297,7 @@ static u8 b43_gphy_aci_scan(struct b43_wldev *dev) > b43_phy_mask(dev, B43_PHY_G_CRS, 0x7FFF); > b43_set_all_gains(dev, 3, 8, 1); > =20 > - start =3D (channel - 5 > 0) ? channel - 5 : 1; > + start =3D (channel > 5) ? channel - 5 : 1; > end =3D (channel + 5 < 14) ? channel + 5 : 13; > =20 > for (i =3D start; i <=3D end; i++) { Nice finding. Acked-by: Michael B=C3=BCsch --=20 Michael https://bues.ch/ --Sig_/QqtpiT/CB7f5fqDpH1ja61U Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEihRzkKVZOnT2ipsS9TK+HZCNiw4FAmFdyy4ACgkQ9TK+HZCN iw4crQ//YkcAD+VIJxm2yzxA85cp8FKUG68UeFSuTudaxcEmwNxvgoM29sYjEk0C zT2gP0KOGrJ5WcjSEVeHs0x8MNJ0mjby9YYGJ30ggM4Mz/jWABF9SckOs4Vou2XA ssWJGPu9Qp44BbQrrJpds81piTlEjPtBuzAusYN58NfnHnI3jSOT+gPw59sQ17Re X7qRCRdNkTejmyE7FtZ19/r0zHhtxJ/cVeSewYRrPdrXr7mIMbXIQeQffRczoGER 4ntZUyHSOTamVrwDNr6X1sg7+p2jYwN2PmQyhH53NYQZcdHEhWcPa9iFBIdBCUyb CXRVP+uZ1nmQ/muZ+tf85Wbm651RN8B20y3eoABozHOVST0wZAs0t5Ql7H1CJsWh 3160MN9nzRG2rCuuXq5MIHzHv8QvPEIH5oev2lzBzH+O4iAjY6J07SKc1ajJtvlt fsfw3WsenslRrUE33js3mM3M8ZMxG0uV8QGbDsIY+xQo6zumN2hja5qaonYnUpkt ZRZM2kA+qTkNvsq0ZaRwiGQnCPpPGT5GCPsZ61woeL1NLPlAq1/nNsPG9skP38Om 3FiwBuz7jbawgO+FOeizDmC1/rz2shzcQ1MLsHa2AvIYPQF9Zmg8VoNpCIBwddgo s6GbKK+1Mt0MOprjl8vAh7IaP02JYtecWFN0E5r9L5gGLqHRP5g= =o5Qg -----END PGP SIGNATURE----- --Sig_/QqtpiT/CB7f5fqDpH1ja61U--