aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/pxa3xx_nand.c
diff options
context:
space:
mode:
authorHaojian Zhuang <haojian.zhuang@marvell.com>2009-09-11 07:33:58 -0400
committerEric Miao <eric.y.miao@gmail.com>2009-11-30 20:02:36 -0500
commita88bdbb54a9352b916877bfc5e316c44ec1b2d8f (patch)
tree504baf6d1b9547446ccc8c686c95499720436832 /drivers/mtd/nand/pxa3xx_nand.c
parent70c7d2dd276dfb6aa802186a2be4efe80d380d15 (diff)
pxa3xx_nand: fix memory out of bound
When fetch nand data with non-DMA mode, we should align info->data_size to 32bit, not 8bit. Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com> Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'drivers/mtd/nand/pxa3xx_nand.c')
-rw-r--r--drivers/mtd/nand/pxa3xx_nand.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/mtd/nand/pxa3xx_nand.c b/drivers/mtd/nand/pxa3xx_nand.c
index 6ea520ae241..f463ad272d3 100644
--- a/drivers/mtd/nand/pxa3xx_nand.c
+++ b/drivers/mtd/nand/pxa3xx_nand.c
@@ -9,6 +9,7 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11
12#include <linux/kernel.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/interrupt.h> 14#include <linux/interrupt.h>
14#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -489,7 +490,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info)
489 switch (info->state) { 490 switch (info->state) {
490 case STATE_PIO_WRITING: 491 case STATE_PIO_WRITING:
491 __raw_writesl(info->mmio_base + NDDB, info->data_buff, 492 __raw_writesl(info->mmio_base + NDDB, info->data_buff,
492 info->data_size << 2); 493 DIV_ROUND_UP(info->data_size, 4));
493 494
494 enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD); 495 enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD);
495 496
@@ -501,7 +502,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info)
501 break; 502 break;
502 case STATE_PIO_READING: 503 case STATE_PIO_READING:
503 __raw_readsl(info->mmio_base + NDDB, info->data_buff, 504 __raw_readsl(info->mmio_base + NDDB, info->data_buff,
504 info->data_size << 2); 505 DIV_ROUND_UP(info->data_size, 4));
505 break; 506 break;
506 default: 507 default:
507 printk(KERN_ERR "%s: invalid state %d\n", __func__, 508 printk(KERN_ERR "%s: invalid state %d\n", __func__,