summaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-04-14 12:31:49 +0300
committerShaohua Li <shli@fb.com>2016-04-14 09:57:59 -0700
commit7dedd15dd2527055390b9742c87a02556d3180f4 (patch)
tree18d258bfbee4dfb7f2240eecf186843acf613535 /drivers/md
parent5b5b7fd185e997ebc18f76b98b9f4ff148d3f5bb (diff)
downloadop-kernel-dev-7dedd15dd2527055390b9742c87a02556d3180f4.zip
op-kernel-dev-7dedd15dd2527055390b9742c87a02556d3180f4.tar.gz
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 <dan.carpenter@oracle.com> Signed-off-by: Shaohua Li <shli@fb.com>
Diffstat (limited to 'drivers/md')
-rw-r--r--drivers/md/raid0.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 2ea12c6..f63dbb6 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) {
OpenPOWER on IntegriCloud