From: Baolin Wang <baolin.wang@spreadtrum.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] pinctrl: sprd: fix off by one bugs
Date: Thu, 07 Sep 2017 11:29:18 +0000 [thread overview]
Message-ID: <20170907112917.GA28053@spreadtrum.com> (raw)
In-Reply-To: <20170907073211.zgcgmdfrphtqy3d7@mwanda>
On 四, 9月 07, 2017 at 02:12:05下午 +0300, Dan Carpenter wrote:
> info->groups[] has info->ngroups elements so these comparisons should be
> >= instead of >.
>
> Fixes: 41d32cfce1ae ("pinctrl: sprd: Add Spreadtrum pin control driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Thanks for fixing my mistakes, please add my tag if it is useful.
Reviewed-by: Baolin Wang <baolin.wang@spreadtrum.com>
>
> diff --git a/drivers/pinctrl/sprd/pinctrl-sprd.c b/drivers/pinctrl/sprd/pinctrl-sprd.c
> index 673b77bbbc8c..939e1bbf6253 100644
> --- a/drivers/pinctrl/sprd/pinctrl-sprd.c
> +++ b/drivers/pinctrl/sprd/pinctrl-sprd.c
> @@ -400,7 +400,7 @@ static int sprd_pmx_set_mux(struct pinctrl_dev *pctldev,
> unsigned long reg;
> unsigned int val = 0;
>
> - if (group_selector > info->ngroups)
> + if (group_selector >= info->ngroups)
> return -EINVAL;
>
> switch (func_selector) {
> @@ -734,7 +734,7 @@ static int sprd_pinconf_group_get(struct pinctrl_dev *pctldev,
> struct sprd_pin_group *grp;
> unsigned int pin_id;
>
> - if (selector > info->ngroups)
> + if (selector >= info->ngroups)
> return -EINVAL;
>
> grp = &info->groups[selector];
> @@ -753,7 +753,7 @@ static int sprd_pinconf_group_set(struct pinctrl_dev *pctldev,
> struct sprd_pin_group *grp;
> int ret, i;
>
> - if (selector > info->ngroups)
> + if (selector >= info->ngroups)
> return -EINVAL;
>
> grp = &info->groups[selector];
> @@ -813,7 +813,7 @@ static void sprd_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
> const char *name;
> int i, ret;
>
> - if (selector > info->ngroups)
> + if (selector >= info->ngroups)
> return;
>
> grp = &info->groups[selector];
next prev parent reply other threads:[~2017-09-07 11:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-07 7:29 [PATCH 1/2] pinctrl: sprd: check for allocation failure Dan Carpenter
2017-09-07 11:12 ` [PATCH 2/2] pinctrl: sprd: fix off by one bugs Dan Carpenter
2017-09-07 11:29 ` Baolin Wang [this message]
2017-09-12 9:28 ` Linus Walleij
2017-09-12 9:27 ` [PATCH 1/2] pinctrl: sprd: check for allocation failure Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170907112917.GA28053@spreadtrum.com \
--to=baolin.wang@spreadtrum.com \
--cc=dan.carpenter@oracle.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).