cciss: handle allocation failure
Subsystems (2)
PATCH 1/1 cciss: handle allocation failure
If kmalloc() fails then cleanup and return failure (-1).
Signed-off-by Dan Carpenter <[email protected]>
drivers/block/cciss.c +3 -0
@@ -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,
Quoted 9 lines · Dan Carpenter
If
kmalloc()fails then cleanup and return failure (-1).Signed-off-by Dan Carpenter <[email protected]>drivers/block/cciss.c +0
-0
drivers/block/cciss.c static int __devinit cciss_init_one(struct pci_dev *pdev, · line 4720
Quoted 9 lines
drivers/block/cciss.c +3
-0@@ -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,
Ack. Thanks.
-- steve
Jens Axboe
AppliedQuoted 1 line · Dan Carpenter
If
kmalloc()fails then cleanup and return failure (-1).
Applied, thanks.
Signature · 1 line
Jens Axboe