summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-08-23 12:28:15 +0200
committerJens Axboe <jaxboe@fusionio.com>2010-08-23 12:28:15 +0200
commit4ee69851cd4880f574d22f5ce08bec35b01c94e3 (patch)
tree1e249690aeb31a8d30e22e7db26eb9331a88c08b
parentcfq-iosched: Documentation help for new tunables (diff)
downloadlinux-4ee69851cd4880f574d22f5ce08bec35b01c94e3.tar.xz
linux-4ee69851cd4880f574d22f5ce08bec35b01c94e3.zip
cciss: handle allocation failure
If kmalloc() fails then cleanup and return failure (-1). Signed-off-by: Dan Carpenter <error27@gmail.com> Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: Jens Axboe <jaxboe@fusionio.com>
-rw-r--r--drivers/block/cciss.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index ce1a75df5902..7191c16954d2 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -4718,6 +4718,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,