Re: [patch] cciss: handle allocation failure

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
> 
> 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
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux