All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] MTD: Fix MTD_MODE_RAW write fail
@ 2010-10-26  2:54 Frank Li
  2010-10-26  3:48 ` Jon Povey
  0 siblings, 1 reply; 3+ messages in thread
From: Frank Li @ 2010-10-26  2:54 UTC (permalink / raw)
  To: linux-mtd; +Cc: Frank Li

mtdchar have not initilized all field of struct mtd_oob_ops
in mtd_write when mode is MTD_MODE_RAW.

function nand_do_write_ops
	if (ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen))
		return -EINVAL;

ooboffs is not initilized at mtd_write.
So random data cause nand_do_write_ops return fail.

Signed-off-by: Frank Li <Frank.Li@freescale.com>
---
 drivers/mtd/mtdchar.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index b7ed09c..58839fa 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -319,6 +319,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
 		case MTD_MODE_RAW:
 		{
 			struct mtd_oob_ops ops;
+			memset(&ops, 0, sizeof(struct mtd_oob_ops));
 
 			ops.mode = MTD_OOB_RAW;
 			ops.datbuf = kbuf;
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/1] MTD: Fix MTD_MODE_RAW write fail
  2010-10-26  2:54 [PATCH 1/1] MTD: Fix MTD_MODE_RAW write fail Frank Li
@ 2010-10-26  3:48 ` Jon Povey
  2010-10-26  9:35   ` Li Frank-B20596
  0 siblings, 1 reply; 3+ messages in thread
From: Jon Povey @ 2010-10-26  3:48 UTC (permalink / raw)
  To: Frank Li, linux-mtd

linux-mtd-bounces@lists.infradead.org wrote:
> mtdchar have not initilized all field of struct mtd_oob_ops
> in mtd_write when mode is MTD_MODE_RAW.
>
> function nand_do_write_ops
>         if (ops->ooboffs && (ops->ooboffs + ops->ooblen > oobmaxlen))
>                 return -EINVAL;
>
> ooboffs is not initilized at mtd_write.
> So random data cause nand_do_write_ops return fail.

Looks like you have found the same thing:

http://lists.infradead.org/pipermail/linux-mtd/2010-September/032453.html
http://lists.infradead.org/pipermail/linux-mtd/2010-October/032538.html

> Signed-off-by: Frank Li <Frank.Li@freescale.com>
> ---
>  drivers/mtd/mtdchar.c |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
> index b7ed09c..58839fa 100644
> --- a/drivers/mtd/mtdchar.c
> +++ b/drivers/mtd/mtdchar.c
> @@ -319,6 +319,7 @@ static ssize_t mtd_write(struct file
> *file, const char __user *buf, size_t count
>                 case MTD_MODE_RAW:
>                 {
>                         struct mtd_oob_ops ops;
> +                       memset(&ops, 0, sizeof(struct mtd_oob_ops));
>
>                         ops.mode = MTD_OOB_RAW;
>                         ops.datbuf = kbuf;



--
Jon Povey
jon.povey@racelogic.co.uk

Racelogic is a limited company registered in England. Registered number 2743719 .
Registered Office Unit 10, Swan Business Centre, Osier Way, Buckingham, Bucks, MK18 1TB .

The information contained in this electronic mail transmission is intended by Racelogic Ltd for the use of the named individual or entity to which it is directed and may contain information that is confidential or privileged. If you have received this electronic mail transmission in error, please delete it from your system without copying or forwarding it, and notify the sender of the error by reply email so that the sender's address records can be corrected. The views expressed by the sender of this communication do not necessarily represent those of Racelogic Ltd. Please note that Racelogic reserves the right to monitor e-mail communications passing through its network

^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH 1/1] MTD: Fix MTD_MODE_RAW write fail
  2010-10-26  3:48 ` Jon Povey
@ 2010-10-26  9:35   ` Li Frank-B20596
  0 siblings, 0 replies; 3+ messages in thread
From: Li Frank-B20596 @ 2010-10-26  9:35 UTC (permalink / raw)
  To: Jon Povey, linux-mtd

> 
> Looks like you have found the same thing:
> 
>
http://lists.infradead.org/pipermail/linux-mtd/2010-September/032453.htm
l
>
http://lists.infradead.org/pipermail/linux-mtd/2010-October/032538.html
> 

Yes. That's the same. 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-10-26  9:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-26  2:54 [PATCH 1/1] MTD: Fix MTD_MODE_RAW write fail Frank Li
2010-10-26  3:48 ` Jon Povey
2010-10-26  9:35   ` Li Frank-B20596

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.