All of lore.kernel.org
 help / color / mirror / Atom feed
From: ycllin@mxic.com.tw
To: "Miquel Raynal" <miquel.raynal@bootlin.com>
Cc: juliensu@mxic.com.tw, linux-kernel@vger.kernel.org,
	linux-mtd@lists.infradead.org, vigneshr@ti.com
Subject: Re: [PATCH 1/2] mtd: nand: ecc-bch: Fix the size of calc_buf/code_buf of the BCH
Date: Fri, 11 Dec 2020 09:20:48 +0800	[thread overview]
Message-ID: <OFCD61AB38.41A2EFE7-ON4825863B.0006C241-4825863B.000765F3@mxic.com.tw> (raw)
In-Reply-To: <20201210223333.204062b1@xps13>


Hi Miquel,
> "Miquel Raynal" <miquel.raynal@bootlin.com> 
> 
> Re: [PATCH 1/2] mtd: nand: ecc-bch: Fix the size of calc_buf/code_buf of 
the BCH
> 
> Hi YouChing,
> 
> YouChing Lin <ycllin@mxic.com.tw> wrote on Thu, 10 Dec 2020 11:22:08
> +0800:
> 
(deleted)
> > The root cause is that the size of calc_buf/code_buf is limited to 64
> > bytes, although sizeof(mtd->oobsize) returns 4, kzalloc() will 
allocate
> > 64 bytes (cache size alignment).
> > 
> > So we correct the size of calc_buf/code_buf to mtd->oobsize.
> > 
> > Signed-off-by: YouChing Lin <ycllin@mxic.com.tw>
> > ---
> >  drivers/mtd/nand/ecc-sw-bch.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/ecc-sw-bch.c 
b/drivers/mtd/nand/ecc-sw-bch.c
> > index 4d8a979..0a0ac11 100644
> > --- a/drivers/mtd/nand/ecc-sw-bch.c
> > +++ b/drivers/mtd/nand/ecc-sw-bch.c
> > @@ -237,8 +237,8 @@ int nand_ecc_sw_bch_init_ctx(struct nand_device 
*nand)
> > 
> >     engine_conf->code_size = code_size;
> >     engine_conf->nsteps = nsteps;
> > -   engine_conf->calc_buf = kzalloc(sizeof(mtd->oobsize), GFP_KERNEL);
> > -   engine_conf->code_buf = kzalloc(sizeof(mtd->oobsize), GFP_KERNEL);
> > +   engine_conf->calc_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
> > +   engine_conf->code_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
> 
> Very nice catch! If you don't mind I will merge this fix with the
> faulty commit (still in next) and I will also bring the fix to Hamming
> which will suffer from the same error.
> 
> Then I will apply the second patch.
 
No problem, thank you for your help.


Thanks,
Youching.


CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information 
and/or personal data, which is protected by applicable laws. Please be 
reminded that duplication, disclosure, distribution, or use of this e-mail 
(and/or its attachments) or any part thereof is prohibited. If you receive 
this e-mail in error, please notify us immediately and delete this mail as 
well as its attachment(s) from your system. In addition, please be 
informed that collection, processing, and/or use of personal data is 
prohibited unless expressly permitted by personal data protection laws. 
Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================



============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================


WARNING: multiple messages have this Message-ID (diff)
From: ycllin@mxic.com.tw
To: "Miquel Raynal" <miquel.raynal@bootlin.com>
Cc: juliensu@mxic.com.tw, linux-mtd@lists.infradead.org,
	linux-kernel@vger.kernel.org, vigneshr@ti.com
Subject: Re: [PATCH 1/2] mtd: nand: ecc-bch: Fix the size of calc_buf/code_buf of the BCH
Date: Fri, 11 Dec 2020 09:20:48 +0800	[thread overview]
Message-ID: <OFCD61AB38.41A2EFE7-ON4825863B.0006C241-4825863B.000765F3@mxic.com.tw> (raw)
In-Reply-To: <20201210223333.204062b1@xps13>


Hi Miquel,
> "Miquel Raynal" <miquel.raynal@bootlin.com> 
> 
> Re: [PATCH 1/2] mtd: nand: ecc-bch: Fix the size of calc_buf/code_buf of 
the BCH
> 
> Hi YouChing,
> 
> YouChing Lin <ycllin@mxic.com.tw> wrote on Thu, 10 Dec 2020 11:22:08
> +0800:
> 
(deleted)
> > The root cause is that the size of calc_buf/code_buf is limited to 64
> > bytes, although sizeof(mtd->oobsize) returns 4, kzalloc() will 
allocate
> > 64 bytes (cache size alignment).
> > 
> > So we correct the size of calc_buf/code_buf to mtd->oobsize.
> > 
> > Signed-off-by: YouChing Lin <ycllin@mxic.com.tw>
> > ---
> >  drivers/mtd/nand/ecc-sw-bch.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/mtd/nand/ecc-sw-bch.c 
b/drivers/mtd/nand/ecc-sw-bch.c
> > index 4d8a979..0a0ac11 100644
> > --- a/drivers/mtd/nand/ecc-sw-bch.c
> > +++ b/drivers/mtd/nand/ecc-sw-bch.c
> > @@ -237,8 +237,8 @@ int nand_ecc_sw_bch_init_ctx(struct nand_device 
*nand)
> > 
> >     engine_conf->code_size = code_size;
> >     engine_conf->nsteps = nsteps;
> > -   engine_conf->calc_buf = kzalloc(sizeof(mtd->oobsize), GFP_KERNEL);
> > -   engine_conf->code_buf = kzalloc(sizeof(mtd->oobsize), GFP_KERNEL);
> > +   engine_conf->calc_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
> > +   engine_conf->code_buf = kzalloc(mtd->oobsize, GFP_KERNEL);
> 
> Very nice catch! If you don't mind I will merge this fix with the
> faulty commit (still in next) and I will also bring the fix to Hamming
> which will suffer from the same error.
> 
> Then I will apply the second patch.
 
No problem, thank you for your help.


Thanks,
Youching.


CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information 
and/or personal data, which is protected by applicable laws. Please be 
reminded that duplication, disclosure, distribution, or use of this e-mail 
(and/or its attachments) or any part thereof is prohibited. If you receive 
this e-mail in error, please notify us immediately and delete this mail as 
well as its attachment(s) from your system. In addition, please be 
informed that collection, processing, and/or use of personal data is 
prohibited unless expressly permitted by personal data protection laws. 
Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================



============================================================================

CONFIDENTIALITY NOTE:

This e-mail and any attachments may contain confidential information and/or personal data, which is protected by applicable laws. Please be reminded that duplication, disclosure, distribution, or use of this e-mail (and/or its attachments) or any part thereof is prohibited. If you receive this e-mail in error, please notify us immediately and delete this mail as well as its attachment(s) from your system. In addition, please be informed that collection, processing, and/or use of personal data is prohibited unless expressly permitted by personal data protection laws. Thank you for your attention and cooperation.

Macronix International Co., Ltd.

=====================================================================


______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2020-12-11  1:23 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-10  3:22 [PATCH 0/2] mtd: spinand: add support for MX35LFxG24AD & Fix bug of BCH YouChing Lin
2020-12-10  3:22 ` YouChing Lin
2020-12-10  3:22 ` [PATCH 1/2] mtd: nand: ecc-bch: Fix the size of calc_buf/code_buf of the BCH YouChing Lin
2020-12-10  3:22   ` YouChing Lin
2020-12-10 21:33   ` Miquel Raynal
2020-12-10 21:33     ` Miquel Raynal
2020-12-11  1:20     ` ycllin [this message]
2020-12-11  1:20       ` ycllin
2020-12-10  3:22 ` [PATCH 2/2] mtd: spinand: macronix: Add support for MX35LFxG24AD YouChing Lin
2020-12-10  3:22   ` YouChing Lin
2020-12-10 21:38   ` Miquel Raynal
2020-12-10 21:38     ` 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=OFCD61AB38.41A2EFE7-ON4825863B.0006C241-4825863B.000765F3@mxic.com.tw \
    --to=ycllin@mxic.com.tw \
    --cc=juliensu@mxic.com.tw \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=vigneshr@ti.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.