Commit a88bdbb5 authored by Haojian Zhuang's avatar Haojian Zhuang Committed by Eric Miao

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: default avatarHaojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: default avatarEric Miao <eric.y.miao@gmail.com>
parent 70c7d2dd
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
* published by the Free Software Foundation. * published by the Free Software Foundation.
*/ */
#include <linux/kernel.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
#include <linux/platform_device.h> #include <linux/platform_device.h>
...@@ -489,7 +490,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info) ...@@ -489,7 +490,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info)
switch (info->state) { switch (info->state) {
case STATE_PIO_WRITING: case STATE_PIO_WRITING:
__raw_writesl(info->mmio_base + NDDB, info->data_buff, __raw_writesl(info->mmio_base + NDDB, info->data_buff,
info->data_size << 2); DIV_ROUND_UP(info->data_size, 4));
enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD); enable_int(info, NDSR_CS0_BBD | NDSR_CS0_CMDD);
...@@ -501,7 +502,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info) ...@@ -501,7 +502,7 @@ static int handle_data_pio(struct pxa3xx_nand_info *info)
break; break;
case STATE_PIO_READING: case STATE_PIO_READING:
__raw_readsl(info->mmio_base + NDDB, info->data_buff, __raw_readsl(info->mmio_base + NDDB, info->data_buff,
info->data_size << 2); DIV_ROUND_UP(info->data_size, 4));
break; break;
default: default:
printk(KERN_ERR "%s: invalid state %d\n", __func__, printk(KERN_ERR "%s: invalid state %d\n", __func__,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment