All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] cciss: handle allocation failure
@ 2010-08-11 22:37 Dan Carpenter
  2010-08-13 14:48 ` scameron
  2010-08-23 10:29 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Dan Carpenter @ 2010-08-11 22:37 UTC (permalink / raw)
  To: kernel-janitors

If kmalloc() fails then cleanup and return failure (-1).

Signed-off-by: Dan Carpenter <error27@gmail.com>

diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
index 31064df..937a7c5 100644
--- a/drivers/block/cciss.c
+++ b/drivers/block/cciss.c
@@ -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,

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [patch] cciss: handle allocation failure
  2010-08-11 22:37 [patch] cciss: handle allocation failure Dan Carpenter
@ 2010-08-13 14:48 ` scameron
  2010-08-23 10:29 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: scameron @ 2010-08-13 14:48 UTC (permalink / raw)
  To: kernel-janitors

On Thu, Aug 12, 2010 at 12:37:40AM +0200, Dan Carpenter wrote:
> If kmalloc() fails then cleanup and return failure (-1).
> 
> Signed-off-by: Dan Carpenter <error27@gmail.com>
> 
> diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c
> index 31064df..937a7c5 100644
> --- a/drivers/block/cciss.c
> +++ b/drivers/block/cciss.c
> @@ -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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] cciss: handle allocation failure
  2010-08-11 22:37 [patch] cciss: handle allocation failure Dan Carpenter
  2010-08-13 14:48 ` scameron
@ 2010-08-23 10:29 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2010-08-23 10:29 UTC (permalink / raw)
  To: kernel-janitors

On 2010-08-12 00:37, Dan Carpenter wrote:
> If kmalloc() fails then cleanup and return failure (-1).

Applied, thanks.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-08-23 10:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-11 22:37 [patch] cciss: handle allocation failure Dan Carpenter
2010-08-13 14:48 ` scameron
2010-08-23 10:29 ` Jens Axboe

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.