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 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