linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Boris Brezillon <boris.brezillon@bootlin.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 2/2] ic3: master: off by one in mode_show()
Date: Mon, 26 Nov 2018 09:46:43 +0100	[thread overview]
Message-ID: <20181126094643.6b1f05cd@bbrezillon> (raw)
In-Reply-To: <20181123071505.ahhh7xqvt4eb7tt2@kili.mountain>

On Fri, 23 Nov 2018 10:15:05 +0300
Dan Carpenter <dan.carpenter@oracle.com> wrote:

> This should be >= ARRAY_SIZE() to avoid reading one element beyond the
> end of the array.
> 
> Fixes: 3a379bbcea0a ("i3c: Add core I3C infrastructure")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Queued to i3c/next.

Thanks,

Boris

> ---
>  drivers/i3c/master.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c
> index bda4b9613e53..c39f89d2deba 100644
> --- a/drivers/i3c/master.c
> +++ b/drivers/i3c/master.c
> @@ -475,7 +475,7 @@ static ssize_t mode_show(struct device *dev,
>  
>  	i3c_bus_normaluse_lock(i3cbus);
>  	if (i3cbus->mode < 0 ||
> -	    i3cbus->mode > ARRAY_SIZE(i3c_bus_mode_strings) ||
> +	    i3cbus->mode >= ARRAY_SIZE(i3c_bus_mode_strings) ||
>  	    !i3c_bus_mode_strings[i3cbus->mode])
>  		ret = sprintf(buf, "unknown\n");
>  	else


      reply	other threads:[~2018-11-26  8:46 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-23  7:15 [PATCH 2/2] ic3: master: off by one in mode_show() Dan Carpenter
2018-11-26  8:46 ` Boris Brezillon [this message]

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=20181126094643.6b1f05cd@bbrezillon \
    --to=boris.brezillon@bootlin.com \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@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).