Skip to content

Commit 62c5520

Browse files
Dan Carpenterliu-song-6
authored andcommitted
md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add()
The linear_conf() returns error pointers, it doesn't return NULL. Update the error checking to match. Fixes: 127186c ("md: reintroduce md-linear") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Reviewed-by: Yu Kuai <yukuai3@huawei.com> Link: https://lore.kernel.org/r/add654be-759f-4b2d-93ba-a3726dae380c@stanley.mountain Signed-off-by: Song Liu <song@kernel.org>
1 parent 3d9a9e9 commit 62c5520

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/md-linear.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
204204
rdev->saved_raid_disk = -1;
205205

206206
newconf = linear_conf(mddev, mddev->raid_disks + 1);
207-
if (!newconf)
208-
return -ENOMEM;
207+
if (IS_ERR(newconf))
208+
return PTR_ERR(newconf);
209209

210210
/* newconf->raid_disks already keeps a copy of * the increased
211211
* value of mddev->raid_disks, WARN_ONCE() is just used to make

0 commit comments

Comments
 (0)