Skip to content

Commit

Permalink
cciss: handle allocation failure
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dan Carpenter authored and Jens Axboe committed Aug 23, 2010
1 parent 6d6ac1c commit 4ee6985
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/block/cciss.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4ee6985

Please sign in to comment.