Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp497809pxb; Wed, 6 Oct 2021 09:17:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzdQ/zg9cpjyaC2H0YKAdrzUzlcfjRkhdr+ZUmhquXEecdkukIIV8F5EnwZVLeiDA8RI7Sr X-Received: by 2002:a63:f90b:: with SMTP id h11mr21185465pgi.165.1633537044497; Wed, 06 Oct 2021 09:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633537044; cv=none; d=google.com; s=arc-20160816; b=xM7fUTXWk6hANR9KDOpooQqvmNB8Z+14RdttFrKM+Gopa61GlsPQlisLkRZV61T3OW 011FZDO1FA0jV6Bnfy++2Bp97Ba3FLhGkLDUyHt0KAYqp8sPHqI32ozX7EUz+pJYihcX RCnNc6cRQc2WxtUZmyvwCVOdYplV2cD9CpAyzaYUYUAjatiBWyV7olKwvVxcnFLYoCHw uzZOZVT9VMKt4j/B1k/j+RtRIsNpBFk2ReVu1ymrzjUnL8VkH1TKoXAjXxRxR74IAO17 AYfsoZvobzsrbrl9EGiuB2h6Dl4bWzn9SbtmvYHzR+3bAtJ+R2ANSOqMb5aWiIiXEbQ+ aXcw== 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=C6HdcpzvhECnpp3MSRtW6WTBPrRVp6ktoj4CzX93jt8=; b=nrbiojaJA+d8+7jSW3Q+us3nXdUiOgh7OdyTuYbMQaGZSO2Bi2fBdKQcgMJwUZ00bL /m2EfjEkyTvmfB5i1FFuE1pmlYSHuSN3aPinoci9QnvxeGiESNWKdbYrH70cWa1NCMLV 7SKfPSUrQsbI6UgIoxv6SKig23TlRSHskAvQjT40bDCOpKvTOE+eq32E76QedN6bYyi7 9LugmKXPQvy8ceK2s3NOWP460cv/y0dyxyyq94Gh1vFh2XM9gvJtDFXv/ej5L7LOVNii 8c2QN1dYyMqRpf5dDrBTkaINJlSDMoUgJ6eV2kIVJ+CLmXG51hwQFSTDaHPpfhwryj5w ySZQ== 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 s3si25143977pgg.461.2021.10.06.09.17.13; Wed, 06 Oct 2021 09:17:24 -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 S231768AbhJFQQn (ORCPT + 75 others); Wed, 6 Oct 2021 12:16:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34366 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232004AbhJFQQn (ORCPT ); Wed, 6 Oct 2021 12:16:43 -0400 Received: from bues.ch (bues.ch [IPv6:2a01:138:9005::1:4]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B559DC061753 for ; Wed, 6 Oct 2021 09:14:50 -0700 (PDT) Received: by bues.ch with esmtpsa (Exim 4.92) (envelope-from ) id 1mY9Z0-0002Y7-VV; Wed, 06 Oct 2021 18:14:39 +0200 Date: Wed, 6 Oct 2021 18:13:58 +0200 From: Michael =?UTF-8?B?QsO8c2No?= To: Dan Carpenter Cc: Larry Finger , Kalle Valo , linux-wireless@vger.kernel.org, b43-dev@lists.infradead.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH 1/2] b43legacy: fix a lower bounds test Message-ID: <20211006181358.67a23e18@wiggum> In-Reply-To: <20211006073542.GD8404@kili> References: <20211006073542.GD8404@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_/goiVgRssi9A8ba=rcm/gfDw"; protocol="application/pgp-signature"; micalg=pgp-sha512 Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org --Sig_/goiVgRssi9A8ba=rcm/gfDw Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, 6 Oct 2021 10:35:42 +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: 75388acd0cd8 ("[B43LEGACY]: add mac80211-based driver for legacy B= CM43xx devices") > Signed-off-by: Dan Carpenter > --- > This fix is correct, but making dead code go live can sometimes expose > bugs which were previously hiding and is always carries a slight risk. >=20 > drivers/net/wireless/broadcom/b43legacy/radio.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/drivers/net/wireless/broadcom/b43legacy/radio.c b/drivers/ne= t/wireless/broadcom/b43legacy/radio.c > index 06891b4f837b..fdf78c10a05c 100644 > --- a/drivers/net/wireless/broadcom/b43legacy/radio.c > +++ b/drivers/net/wireless/broadcom/b43legacy/radio.c > @@ -283,7 +283,7 @@ u8 b43legacy_radio_aci_scan(struct b43legacy_wldev *d= ev) > & 0x7FFF); > b43legacy_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_/goiVgRssi9A8ba=rcm/gfDw Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEihRzkKVZOnT2ipsS9TK+HZCNiw4FAmFdy0YACgkQ9TK+HZCN iw5iWA//Qsq+DuoC10lMYoTH3WkopAMR9mKhwbe5FTZUUe0eWQM3r9a7uGKGKOX2 LW47biXVl/9u0PiUulvLWklyV2Kg6QKCewOLmUHbZB7XBPW0PVf/67KRL3Y4Iz7p 0nZhcOzkv00cyoQ5wIOBcjrrqwK9+u0BgK1VUDRWd8yblOyK8jPTaIEf6x0E1VPT 1Ve7yeETJzioF8xeTCgBoY2SUUGAfZ91C/w5dtctfPkuW8RSHwqFH0553f9QICQS z9XDBvESlPY7GLzDSXv/TulyRPqK3K+jZA5zuiOlW5XJpXiOax1xdNyq/GwcGpV7 a332WOmx4Q0Edc/183OUpx1xoIHFLQiMfs6kpmkvgoaqWdCdjzF7yTr9xXOcM3S7 YSR3Be18aarCLhGR354xz+Wbvb69IIS7hEwK7lBZwD7u6Jd/KyLU+3k77D69gdzl y+33iLFxH1pWtsw/wGwZrPH1hl9LUE18s3S4vfKpJ4EqJ20+nIGIPgf2EPGhEaEW IUnA5es/jscNcYdCTvfffyeKRwyo1NZhJHBslqVqF6InC+MMilFHBZo+2ZA3Swey NBdDueAsTFF/XAdep9Y32U1l1aiXfUoVROXPFQtGnX1V7qP3Aucx1Kpt9ZPiqk4Y QI85MyfpA7WDWEYLjBP9APcX2uI29nTHrRsztGJxx+SDycGymWU= =mGEZ -----END PGP SIGNATURE----- --Sig_/goiVgRssi9A8ba=rcm/gfDw--