public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Miquel Raynal <miquel.raynal@bootlin.com>
To: Dan Carpenter <dan.carpenter@oracle.com>
Cc: Boris Brezillon <bbrezillon@kernel.org>,
	Richard Weinberger <richard@nod.at>,
	kernel-janitors@vger.kernel.org,
	Marek Vasut <marek.vasut@gmail.com>,
	Liang Yang <liang.yang@amlogic.com>,
	linux-mtd@lists.infradead.org,
	Kevin Hilman <khilman@baylibre.com>,
	linux-amlogic@lists.infradead.org,
	Brian Norris <computersforpeace@gmail.com>,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip()
Date: Tue, 05 Feb 2019 13:08:18 +0000	[thread overview]
Message-ID: <20190205140818.2de31843@xps13> (raw)
In-Reply-To: <20190201082922.GC8459@kadam>

Hi Dan,

Dan Carpenter <dan.carpenter@oracle.com> wrote on Fri, 1 Feb 2019
11:29:22 +0300:

> This test is off by one because the > should be >= and it's also testing
> against the wrong limit.  The MAX_CE_NUM is the maximum size that
> meson_chip->sels[] is allowed to be but meson_chip->nsels is the actual
> size.
> 
> Fixes: 2d570b34b41a ("mtd: rawnand: meson: add support for Amlogic NAND flash controller ")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/mtd/nand/raw/meson_nand.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/raw/meson_nand.c b/drivers/mtd/nand/raw/meson_nand.c
> index e858d58d97b0..94c90be7e1e0 100644
> --- a/drivers/mtd/nand/raw/meson_nand.c
> +++ b/drivers/mtd/nand/raw/meson_nand.c
> @@ -225,7 +225,7 @@ static void meson_nfc_select_chip(struct nand_chip *nand, int chip)
>  	struct meson_nfc *nfc = nand_get_controller_data(nand);
>  	int ret, value;
>  
> -	if (chip < 0 || WARN_ON_ONCE(chip > MAX_CE_NUM))
> +	if (chip < 0 || WARN_ON_ONCE(chip >= meson_chip->nsels))
>  		return;
>  
>  	nfc->param.chip_select = meson_chip->sels[chip] ? NAND_CE1 : NAND_CE0;

I am gonna fold this three patches if this is fine for you with the
original patch adding the driver which is currently in my next branch.


Thanks,
Miquèl

  parent reply	other threads:[~2019-02-05 13:08 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-01  8:29 [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip() Dan Carpenter
2019-02-02  3:01 ` Liang Yang
2019-02-05 13:08 ` Miquel Raynal [this message]
2019-02-05 15:38   ` Dan Carpenter
2019-02-05 19:07 ` Miquel Raynal

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=20190205140818.2de31843@xps13 \
    --to=miquel.raynal@bootlin.com \
    --cc=bbrezillon@kernel.org \
    --cc=computersforpeace@gmail.com \
    --cc=dan.carpenter@oracle.com \
    --cc=dwmw2@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=khilman@baylibre.com \
    --cc=liang.yang@amlogic.com \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=marek.vasut@gmail.com \
    --cc=richard@nod.at \
    /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