Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3316753pxk; Mon, 5 Oct 2020 06:52:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxIs+nLFPYccNsNRrN8Sdba+s88Ylu029OfWwHB45kVzgTA1LQ1LjSqz6dbJF1Mhi2v4jtw X-Received: by 2002:a17:906:aad5:: with SMTP id kt21mr10790168ejb.5.1601905973014; Mon, 05 Oct 2020 06:52:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601905973; cv=none; d=google.com; s=arc-20160816; b=yUwu/LGeHJu+rh8aKhTXvjsj+ybyxWx2A7d6WMYoDGFmovWi8cNPyRbEkQhYBmfT42 AWg0nLwWRea9PXsTNi9TYuIHuAU5/NMQYe7DMJPhOVaKAfiZ07EyNf2v2AtplotWAIjd IIN0zL7gvgVyTUHCQ6gg5jC+VaKulgYp8SzhzHz1p44lPtR5NiZDXAoQ1w6MqCyx/oHK dU+Z0NZMlMmSE/YjidH3wVvB1VPcouKEPDUStVlgMGih9V8flY+XhQx6QjDwKjIpS3JV UcGHd/toG8UTJRKa4p9IHPyen1usvXYypHb3NYcI3lqeeXAb98cYQ4HjBPQiv4Qfl+1A onwA== 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=nqAoqB91TG7xAVjHKpMd3VRR8yaZ9Y8BR2WUPwtBpyI=; b=jldrpNyCni2R1dzSWl+HBd1FW/lkY0pYRCvnHJgZUZeGkrXXeo/71JC2cIRLbMz3vP PYWeedE8OBWlDQlS6IaN4rCAV9dulESpd8NvGJTUu1l7rGP+CqZH1v8iHy+sVSVVGn/F t1lL+/iXXYx7gsIfhcvUt0F/oD4X1HYNmrTMiT6EU26S4/wXixAhrfnRyKoVjH0VZHLA MA4SVUsxcXms3pZ+e4fO+oBIiYpWtVqqFu33Df3Cwneef51W+dukARmQZ2xODyyU4lDm rmops7n+2bZqOg+zn4fykKlTf9N/NDS/sEvH/xKjyfz5y2gN2sqUzO0O0CremacS5/Br iwMw== 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 v19si6854451ejf.257.2020.10.05.06.52.29; Mon, 05 Oct 2020 06:52:53 -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 S1726078AbgJENuu (ORCPT + 99 others); Mon, 5 Oct 2020 09:50:50 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:56702 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725911AbgJENuu (ORCPT ); Mon, 5 Oct 2020 09:50:50 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 30C841C0B77; Mon, 5 Oct 2020 15:50:47 +0200 (CEST) Date: Mon, 5 Oct 2020 15:50:46 +0200 From: Pavel Machek To: Marek Behun Cc: ultracoolguy@tutanota.com, Dmurphy , Linux Leds , Trivial , linux-kernel@vger.kernel.org Subject: Re: [PATCH] leds: lm3697: Fix out-of-bound access Message-ID: <20201005135046.GA26765@duo.ucw.cz> References: <20201005141334.36d9441a@blackhole.sk> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="n8g4imXOkfNTN/H1" Content-Disposition: inline In-Reply-To: <20201005141334.36d9441a@blackhole.sk> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --n8g4imXOkfNTN/H1 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi! > > if (ret) > > dev_err(&priv->client->dev, "Cannot write OUTPUT config\n"); > >=20 > > - for (i =3D 0; i < LM3697_MAX_CONTROL_BANKS; i++) { > > + for (i =3D 0; i < priv->num_leds; i++) { >=20 > Ultracoolguy is correct that this for cycle should not iterate > LM3697_MAX_CONTROL_BANKS. Instead, the count check in lm3697_probe should= be changed from >=20 > if (!count) > to > if (!count || count > LM3697_MAX_CONTROL_BANKS) >=20 > (the error message should also be changed, or maybe dropped, and the > error code changed from -ENODEV to -EINVAL, if we use || operator). I guess Dan (or someone else?) can submit simple one-liner I could apply into -for-next (and maybe stable), and then we can sort the naming etc in the driver? Gettings banks vs. LEDs right would be nice. Thanks and best regards, Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --n8g4imXOkfNTN/H1 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABECAB0WIQRPfPO7r0eAhk010v0w5/Bqldv68gUCX3sktgAKCRAw5/Bqldv6 8nn/AJ9plJ17mUe1BmlOkkLDOrp60YN95wCgitYQ9BT4aZATHV5sfkRBbnCA9lM= =xGtn -----END PGP SIGNATURE----- --n8g4imXOkfNTN/H1--