linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pch_uart: check kzalloc result in dma_handle_tx()
@ 2012-07-28 12:43 Fengguang Wu
  0 siblings, 0 replies; only message in thread
From: Fengguang Wu @ 2012-07-28 12:43 UTC (permalink / raw)
  To: Tomoya MORINAGA
  Cc: Alan Cox, Greg Kroah-Hartman, linux-serial, LKML, kernel-janitors

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@intel.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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-07-28 12:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-28 12:43 [PATCH] pch_uart: check kzalloc result in dma_handle_tx() Fengguang Wu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).