[241/262] mtd: mtdchar: add missing initializer on raw write

From: Greg KH
Date: Wed Nov 09 2011 - 22:33:21 EST


3.0-stable review patch. If anyone has any objections, please let me know.

------------------

From: Peter Wippich <pewi@xxxxxxxxxxxxxxxxx>

commit bf5140817b2d65faac9b32fc9057a097044ac35b upstream.

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@xxxxxxxxxxxxxxxxx>
Tested-by: Ricard Wanderlof <ricardw@xxxxxxxx>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@xxxxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
drivers/mtd/mtdchar.c | 1 +
1 file changed, 1 insertion(+)

--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -320,6 +320,7 @@ static ssize_t mtd_write(struct file *fi
ops.mode = MTD_OOB_RAW;
ops.datbuf = kbuf;
ops.oobbuf = NULL;
+ ops.ooboffs = 0;
ops.len = len;

ret = mtd->write_oob(mtd, *ppos, &ops);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/