summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@freescale.com>2010-10-19 18:25:02 +0800
committerScott Sweeny <scott.sweeny@timesys.com>2011-01-19 11:50:09 -0500
commit13deb152022ce7f46b67b58c157a438776df5657 (patch)
tree7edd21376794d4473b12fbd71947ab34f93c2d9f /drivers
parentd3ffb868e50fc29824aa7adad33f1beea7f44cb8 (diff)
ENGR00132026 MTD: Fix MTD_MODE_RAW write fail
Kobs-ng use MTD_MODE_RAW write boot stream to NAND flash. 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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/mtd/mtdchar.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/mtd/mtdchar.c b/drivers/mtd/mtdchar.c
index 91c8013cf0d9..8bebfa55cd4a 100644
--- a/drivers/mtd/mtdchar.c
+++ b/drivers/mtd/mtdchar.c
@@ -304,6 +304,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;