From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Carpenter Date: Fri, 05 Jul 2013 06:05:46 +0000 Subject: [patch -next] bcache: check for allocation failures Message-Id: <20130705060307.GB14443@elgon.mountain> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable To: Kent Overstreet , Gabriel de Perthuis Cc: Neil Brown , linux-bcache-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-raid-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, kernel-janitors-u79uwXL29TY76Z2rM5mHXA@public.gmane.org There is a missing NULL check after the kzalloc(). Signed-off-by: Dan Carpenter 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 =3D kzalloc(sizeof(struct kobj_uevent_env), GFP_KERNEL); + if (!env) + return -ENOMEM; add_uevent_var(env, "DRIVER=BCache"); add_uevent_var(env, "CACHED_UUID=3D%pU", dc->sb.uuid), add_uevent_var(env, "CACHED_LABEL=3D%s", buf); -- To unsubscribe from this list: send the line "unsubscribe kernel-janitors" = in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html