Commit 4ee69851 authored by Dan Carpenter's avatar Dan Carpenter Committed by Jens Axboe

cciss: handle allocation failure

If kmalloc() fails then cleanup and return failure (-1).
Signed-off-by: default avatarDan Carpenter <error27@gmail.com>
Acked-by: default avatarStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: default avatarJens Axboe <jaxboe@fusionio.com>
parent 6d6ac1c1
...@@ -4718,6 +4718,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev, ...@@ -4718,6 +4718,9 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
h->scatter_list = kmalloc(h->max_commands * h->scatter_list = kmalloc(h->max_commands *
sizeof(struct scatterlist *), sizeof(struct scatterlist *),
GFP_KERNEL); GFP_KERNEL);
if (!h->scatter_list)
goto clean4;
for (k = 0; k < h->nr_cmds; k++) { for (k = 0; k < h->nr_cmds; k++) {
h->scatter_list[k] = kmalloc(sizeof(struct scatterlist) * h->scatter_list[k] = kmalloc(sizeof(struct scatterlist) *
h->maxsgentries, h->maxsgentries,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment