* [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip()
@ 2019-02-01 8:29 Dan Carpenter
2019-02-02 3:01 ` Liang Yang
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-01 8:29 UTC (permalink / raw)
To: Liang Yang
Cc: Boris Brezillon, Richard Weinberger, kernel-janitors,
Marek Vasut, linux-mtd, Kevin Hilman, Miquel Raynal,
linux-amlogic, Brian Norris, David Woodhouse
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;
--
2.17.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip()
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
2019-02-05 19:07 ` Miquel Raynal
2 siblings, 0 replies; 5+ messages in thread
From: Liang Yang @ 2019-02-02 3:01 UTC (permalink / raw)
To: Dan Carpenter
Cc: Boris Brezillon, Richard Weinberger, kernel-janitors,
Marek Vasut, linux-mtd, Kevin Hilman, Miquel Raynal,
linux-amlogic, Brian Norris, David Woodhouse
Hi Dan,
On 2019/2/1 16:29, Dan Carpenter wrote:
> 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;
>
Thank you.
Acked-by: Liang Yang <liang.yang@amlogic.com>
> nfc->param.chip_select = meson_chip->sels[chip] ? NAND_CE1 : NAND_CE0;
>
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip()
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
2019-02-05 15:38 ` Dan Carpenter
2019-02-05 19:07 ` Miquel Raynal
2 siblings, 1 reply; 5+ messages in thread
From: Miquel Raynal @ 2019-02-05 13:08 UTC (permalink / raw)
To: Dan Carpenter
Cc: Boris Brezillon, Richard Weinberger, kernel-janitors,
Marek Vasut, Liang Yang, linux-mtd, Kevin Hilman, linux-amlogic,
Brian Norris, David Woodhouse
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
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip()
2019-02-05 13:08 ` Miquel Raynal
@ 2019-02-05 15:38 ` Dan Carpenter
0 siblings, 0 replies; 5+ messages in thread
From: Dan Carpenter @ 2019-02-05 15:38 UTC (permalink / raw)
To: Miquel Raynal
Cc: Boris Brezillon, Richard Weinberger, kernel-janitors,
Marek Vasut, Liang Yang, linux-mtd, Kevin Hilman, linux-amlogic,
Brian Norris, David Woodhouse
On Tue, Feb 05, 2019 at 02:08:18PM +0100, Miquel Raynal wrote:
> > - 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.
No problem.
regards,
dan carpenter
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/3] mtd: rawnand: meson: Fix a limit test in meson_nfc_select_chip()
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
@ 2019-02-05 19:07 ` Miquel Raynal
2 siblings, 0 replies; 5+ messages in thread
From: Miquel Raynal @ 2019-02-05 19:07 UTC (permalink / raw)
To: Dan Carpenter
Cc: Boris Brezillon, Richard Weinberger, kernel-janitors,
Marek Vasut, Liang Yang, linux-mtd, Kevin Hilman, linux-amlogic,
Brian Norris, David Woodhouse
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(-)
>
Series merged in nand/next with the original commit.
Thanks,
Miquèl
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-02-05 19:08 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2019-02-05 15:38 ` Dan Carpenter
2019-02-05 19:07 ` Miquel Raynal
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).