[PATCH -mm] atmel_serial: Fix broken RX buffer allocation

From: Haavard Skinnemoen
Date: Thu Jan 31 2008 - 09:53:55 EST


Introduced by atmel_serial-split-the-interrupt-handler.patch.

Thanks to michael <trimarchi@xxxxxxxxxxxxxxxx> for spotting it.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@xxxxxxxxx>
---
It was surprisingly difficult to actually provoke a crash without this
patch, but the system did start to behave rather funny after
transferring a lot of data.

drivers/serial/atmel_serial.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c
index 62654ab..477950f 100644
--- a/drivers/serial/atmel_serial.c
+++ b/drivers/serial/atmel_serial.c
@@ -1477,7 +1477,8 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev)

if (!atmel_use_dma_rx(&port->uart)) {
ret = -ENOMEM;
- data = kmalloc(ATMEL_SERIAL_RINGSIZE, GFP_KERNEL);
+ data = kmalloc(sizeof(struct atmel_uart_char)
+ * ATMEL_SERIAL_RINGSIZE, GFP_KERNEL);
if (!data)
goto err_alloc_ring;
port->rx_ring.buf = data;
--
1.5.3.8

--
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/