提交 4ee69851 编写于 作者: D Dan Carpenter 提交者: Jens Axboe

cciss: handle allocation failure

If kmalloc() fails then cleanup and return failure (-1).
Signed-off-by: NDan Carpenter <error27@gmail.com>
Acked-by: NStephen M. Cameron <scameron@beardog.cce.hp.com>
Signed-off-by: NJens Axboe <jaxboe@fusionio.com>
上级 6d6ac1c1
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册