Re: [patch -next] bcache: check for allocation failures

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

 



On Fri, Jul 05, 2013 at 09:05:46AM +0300, Dan Carpenter wrote:
> There is a missing NULL check after the kzalloc().
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
> 
> diff --git a/drivers/md/bcache/sysfs.c b/drivers/md/bcache/sysfs.c
> index 48f0353..4fe6ab2 100644
> --- a/drivers/md/bcache/sysfs.c
> +++ b/drivers/md/bcache/sysfs.c
> @@ -232,6 +232,8 @@ STORE(__cached_dev)
>  			bch_uuid_write(dc->disk.c);
>  		}
>  		env = kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL);
> +		if (!env)
> +			return -ENOMEM;
>  		add_uevent_var(env, "DRIVER=bcache");
>  		add_uevent_var(env, "CACHED_UUID=%pU", dc->sb.uuid),
>  		add_uevent_var(env, "CACHED_LABEL=%s", buf);

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




[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux