[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20120728124357.GA13192@localhost>
Date: Sat, 28 Jul 2012 20:43:57 +0800
From: Fengguang Wu <fengguang.wu@...el.com>
To: Tomoya MORINAGA <tomoya.rohm@...il.com>
Cc: Alan Cox <alan@...ux.intel.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
linux-serial@...r.kernel.org, LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: [PATCH] pch_uart: check kzalloc result in dma_handle_tx()
Reported by coccinelle:
drivers/tty/serial/pch_uart.c:979:1-14: alloc with no test, possible model on line 994
Signed-off-by: Fengguang Wu <fengguang.wu@...el.com>
---
drivers/tty/serial/pch_uart.c | 4 ++++
1 file changed, 4 insertions(+)
WARNING: this may be a superficial fix!
--- linux.orig/drivers/tty/serial/pch_uart.c 2012-06-07 05:39:57.550846385 +0800
+++ linux/drivers/tty/serial/pch_uart.c 2012-07-28 20:37:27.803145392 +0800
@@ -974,6 +974,10 @@ static unsigned int dma_handle_tx(struct
priv->tx_dma_use = 1;
priv->sg_tx_p = kzalloc(sizeof(struct scatterlist)*num, GFP_ATOMIC);
+ if (!priv->sg_tx_p) {
+ dev_err(priv->port.dev, "%s:kzalloc Failed\n", __func__);
+ return 0;
+ }
sg_init_table(priv->sg_tx_p, num); /* Initialize SG table */
sg = priv->sg_tx_p;
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists