Re: [patch] [SCSI] libosd: check for kzalloc() failure

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

 




Am 30.01.2013 08:06, schrieb Dan Carpenter:
> There wasn't any error handling for this kzalloc().
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/scsi/osd/osd_initiator.c b/drivers/scsi/osd/osd_initiator.c
> index c06b8e5..d8293f2 100644
> --- a/drivers/scsi/osd/osd_initiator.c
> +++ b/drivers/scsi/osd/osd_initiator.c
> @@ -144,6 +144,10 @@ static int _osd_get_print_system_info(struct osd_dev *od,
>  	odi->osdname_len = get_attrs[a].len;
>  	/* Avoid NULL for memcmp optimization 0-length is good enough */
>  	odi->osdname = kzalloc(odi->osdname_len + 1, GFP_KERNEL);
> +	if (!odi->osdname) {
> +		ret = -ENOMEM;
> +		goto out;
> +	}
>  	if (odi->osdname_len)
>  		memcpy(odi->osdname, get_attrs[a].val_ptr, odi->osdname_len);
>  	OSD_INFO("OSD_NAME               [%s]\n", odi->osdname);
> --

this looks like strdup() ?

re,
 wh
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux