Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1347252ybn; Wed, 2 Oct 2019 14:48:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqzIMVcWohQBjLH5espDCnRVZgGXRU/AcBdb7FdUYBiG8CmFkDUaT4DWkklBltZb/Ld3SnhY X-Received: by 2002:a17:906:90d4:: with SMTP id v20mr5133598ejw.189.1570052923308; Wed, 02 Oct 2019 14:48:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570052923; cv=none; d=google.com; s=arc-20160816; b=UX1ONkPXv8Ek9eYpqVy0F+uTHhzdf4M83unD5KFdCurYzH3b3Zck2JwPWaTV4vjhTM r1GgplNyk5Ya4JCFsy8LzLLkC+k3IOcWMHfMzMjzO/td0++61Yj2tzT/W33KAVAv6tnp Q5BpVAwrA6PAbUR7+i1wXU9FmjYe6kLyvAMVmeqF0jk2ygV5fGUOyJMCkvwuHJEqAVhx cesa0Yl8Hfq735r4pnVwzZNE1xSbIAnHidcuZJyJ49TqOMiGCzhTEa6iHq0iYlya2ePV /OeBLUmkixQsVc6huApHe2mUDEKkwJAgjxP+YIjX26fIckd4P9Dy0lkNL56DevLpxyP5 0lCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=j7Oj9/NMOxxlIgyK+rsgtpkeEf8Sqt/NUKWjxaLjPJg=; b=IYkEk97DCW/A9F85CkTBsh/c8RrDnzhmd+rd2MF4AneHKsmmT5niQml+jNVciOe4t2 oMkCv3Xj/I8s5rq/FZb1Fc9FCT+FSr6bjhATe9911fll7LNIDoM++7AIZWjaKIGRKSbG ceA+jI0CH8T6UyES5gJvwbsls5ucndeKrN8EFXCyrN/tPsbhEgNckp/oAVgfkWZpAHKD LlAvY99wKZLaFL+07EF9wq0jBzDP2iU9w+djoaNm3F+tv+wwYrMSRFV/9jRe1hv6Oe2v SGiM7c3hhYfaknGEcQwJX1UPEBp95jSbXJ0ZZgLkH8Ddn4J3XnXOJxpStZJofhm61Mns stVg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=cHRFCtRp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a23si291843edj.201.2019.10.02.14.48.19; Wed, 02 Oct 2019 14:48:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@broadcom.com header.s=google header.b=cHRFCtRp; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=broadcom.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726772AbfJBUG5 (ORCPT + 99 others); Wed, 2 Oct 2019 16:06:57 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:37906 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726523AbfJBUG5 (ORCPT ); Wed, 2 Oct 2019 16:06:57 -0400 Received: by mail-pg1-f196.google.com with SMTP id x10so190262pgi.5 for ; Wed, 02 Oct 2019 13:06:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=j7Oj9/NMOxxlIgyK+rsgtpkeEf8Sqt/NUKWjxaLjPJg=; b=cHRFCtRp3DATBrikB2f0LyWMSc83/gSCADBiAFa1Soi99gYQUDknOBH4kygMKEsecc 6YAxpO8sFAQciMNcrj7gajbPZlQ5cg/uTOU+EfGdO5XKdL1oC9JT5K0o/pmeq3YFuZgv ch0tgm7SgDkNk7LnIy2NaX0hZ6cH+3u8MQNJE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=j7Oj9/NMOxxlIgyK+rsgtpkeEf8Sqt/NUKWjxaLjPJg=; b=LaBdQKPmHflHlAaAJ4QiimUlDWL5a8ahpAYAwh2F102MdXXVWaZ29TirXzRq6bolKz 2eBKnG5wFFRLCivProb/52h6Xtm3idL1X8/T1F6ia1sQjkRZu0hURE4TTmcTRClRJDes mULJ8Nlu4zog4iQiUds6IR1z5eV0rwn10+BNlRvzqpzpWrEWS2nscPDcv9rIrVy39RvJ g4vLjg7lNVj6p9IbkUq9O3UAHeCTsIaIzFoOh9DPwbGlkCOasxOXhcLYRewoeApKBsZQ V484zVoRslcifkiJAws8pTwQRUkE/bYRhSvtGpxwwSMPdnqjCQvQ6BAKP4Z9v/kEEER2 Zw6g== X-Gm-Message-State: APjAAAXVGWcjikBGd+2kRVTOcNYphyqn4g6BaVT6wEmJMqDBfGKaBbTS wRnSIGq/8q44mWPRZ0jSYnB0OhABLRcmew== X-Received: by 2002:a65:6709:: with SMTP id u9mr5780827pgf.59.1570046816188; Wed, 02 Oct 2019 13:06:56 -0700 (PDT) Received: from [10.136.13.65] ([192.19.228.250]) by smtp.gmail.com with ESMTPSA id x11sm8343937pja.3.2019.10.02.13.06.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 02 Oct 2019 13:06:55 -0700 (PDT) Subject: Re: [PATCH] ns2: Fix off by one bugs in ns2_pinmux_enable() To: Dan Carpenter , Ray Jui , Yendapally Reddy Dhananjaya Reddy Cc: Scott Branden , bcm-kernel-feedback-list@broadcom.com, Linus Walleij , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: <20190926081426.GB2332@mwanda> From: Scott Branden Message-ID: <98717865-0417-96d7-58f3-84f6394a1bf3@broadcom.com> Date: Wed, 2 Oct 2019 13:06:52 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <20190926081426.GB2332@mwanda> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org thanks for fix. On 2019-09-26 1:14 a.m., Dan Carpenter wrote: > The pinctrl->functions[] array has pinctrl->num_functions elements and > the pinctrl->groups[] array is the same way. These are set in > ns2_pinmux_probe(). So the > comparisons should be >= so that we don't > read one element beyond the end of the array. > > Fixes: b5aa1006e4a9 ("pinctrl: ns2: add pinmux driver support for Broadcom NS2 SoC") > Signed-off-by: Dan Carpenter Acked-by: Scott Branden > --- > drivers/pinctrl/bcm/pinctrl-ns2-mux.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c > index 2bf6af7df7d9..9fabc451550e 100644 > --- a/drivers/pinctrl/bcm/pinctrl-ns2-mux.c > +++ b/drivers/pinctrl/bcm/pinctrl-ns2-mux.c > @@ -640,8 +640,8 @@ static int ns2_pinmux_enable(struct pinctrl_dev *pctrl_dev, > const struct ns2_pin_function *func; > const struct ns2_pin_group *grp; > > - if (grp_select > pinctrl->num_groups || > - func_select > pinctrl->num_functions) > + if (grp_select >= pinctrl->num_groups || > + func_select >= pinctrl->num_functions) > return -EINVAL; > > func = &pinctrl->functions[func_select];