summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-09-20 09:00:47 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-09-20 09:01:03 +0200
commitbf3b7c6a8f197114305fc31d3bfa4c73dbae50e4 (patch)
treeabde6505e85f74d343be227c605a9443df7a4849
parent660809446f5e4cefaf962e6044d5060d194bbd4a (diff)
downloadbarebox-bf3b7c6a8f197114305fc31d3bfa4c73dbae50e4.tar.gz
mtd mtdraw: fix fixing partial page read
toread is unitialized. We have to use count instead. | commit 992c291e9561381cf86d4a7fc9271c2b60fea0c1 | Author: Sascha Hauer <s.hauer@pengutronix.de> | Date: Sat Sep 15 16:54:47 2012 +0200 | | mtd mtdraw: Fix partial page read | | When reading parts of a page we have to limit the maximum bytes copied | to the remaining bytes of a page. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--drivers/mtd/mtdraw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/mtd/mtdraw.c b/drivers/mtd/mtdraw.c
index dab9bbc..f541802 100644
--- a/drivers/mtd/mtdraw.c
+++ b/drivers/mtd/mtdraw.c
@@ -128,7 +128,7 @@ static ssize_t mtdraw_read(struct cdev *cdev, void *buf, size_t count,
skip = offset % (mtd->writesize + mtd->oobsize);
while (ret > 0 && count > 0) {
- toread = min_t(int, toread,
+ toread = min_t(int, count,
mtd->writesize + mtd->oobsize - skip);
ret = mtdraw_read_unaligned(mtd, buf, toread,
skip, numpage++ * mtd->writesize);