public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] cciss: handle allocation failure
@ 2010-08-11 22:37 Dan Carpenter
  2010-08-13 14:48 ` scameron
  2010-08-23 10:29 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-08-11 22:37 UTC (permalink / raw)
  To: kernel-janitors

If kmalloc() fails then cleanup and return failure (-1).

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 31064df..937a7c5 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4712,6 +4712,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 	h->scatter_list = kmalloc(h->max_commands *
 						sizeof(struct scatterlist *),
 						GFP_KERNEL);
+	if (!h->scatter_list)
+		goto clean4;
+
 	for (k = 0; k < h->nr_cmds; k++) {
 		h->scatter_list[k] = kmalloc(sizeof(struct scatterlist) *
 							h->maxsgentries,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-23 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-11 22:37 [patch] cciss: handle allocation failure Dan Carpenter
2010-08-13 14:48 ` scameron
2010-08-23 10:29 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox