mtd: mtdchar: add missing initializer on raw write

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Mon Nov 7 11:59:10 EST 2011


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=bf5140817b2d65faac9b32fc9057a097044ac35b
Commit:     bf5140817b2d65faac9b32fc9057a097044ac35b
Parent:     8b6e50c9eba8bf44b2dfd931d359706a461d2cfd
Author:     Peter Wippich <pewi at gw-instruments.de>
AuthorDate: Mon Jun 6 15:50:58 2011 +0200
Committer:  Artem Bityutskiy <artem.bityutskiy at intel.com>
CommitDate: Sun Sep 11 15:02:04 2011 +0300

    mtd: mtdchar: add missing initializer on raw write
    
    On writes in MODE_RAW the mtd_oob_ops struct is not sufficiently
    initialized which may cause nandwrite to fail. With this patch
    it is possible to write raw nand/oob data without additional ECC
    (either for testing or when some sectors need different oob layout
    e.g. bootloader) like
    nandwrite  -n -r -o  /dev/mtd0 <myfile>
    
    Signed-off-by: Peter Wippich <pewi at gw-instruments.de>
    Cc: stable at kernel.org
    Tested-by: Ricard Wanderlof <ricardw at axis.com>
    Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy at nokia.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 f1af222..49e20a4 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -320,6 +320,7 @@ static ssize_t mtd_write(struct file *file, const char __user *buf, size_t count
 			ops.mode = MTD_OOB_RAW;
 			ops.datbuf = kbuf;
 			ops.oobbuf = NULL;
+			ops.ooboffs = 0;
 			ops.len = len;
 
 			ret = mtd->write_oob(mtd, *ppos, &ops);



More information about the linux-mtd-cvs mailing list