From: Dan Carpenter Date: Thu, 14 Apr 2016 09:31:49 +0000 (+0300) Subject: md/raid0: fix uninitialized variable bug X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=7dedd15dd2527055390b9742c87a02556d3180f4;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git md/raid0: fix uninitialized variable bug If this function fails the callers expect that *private_conf is set to an ERR_PTR() but that isn't true for the first error path where we can't allocate "conf". It leads to some uninitialized variable bugs. Signed-off-by: Dan Carpenter Signed-off-by: Shaohua Li --- diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index 2ea12c6bf659..f63dbb68e3a9 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c @@ -85,6 +85,7 @@ static int create_strip_zones(struct mddev *mddev, struct r0conf **private_conf) struct r0conf *conf = kzalloc(sizeof(*conf), GFP_KERNEL); unsigned short blksize = 512; + *private_conf = ERR_PTR(-ENOMEM); if (!conf) return -ENOMEM; rdev_for_each(rdev1, mddev) {