Skip to content

Commit 290266e

Browse files
committed
md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add()
JIRA: https://issues.redhat.com/browse/RHEL-73514 commit 62c5520 Author: Dan Carpenter <dan.carpenter@linaro.org> Date: Wed Jan 15 09:53:52 2025 +0300 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> (cherry picked from commit 62c5520) Signed-off-by: Nigel Croxon <ncroxon@redhat.com>
1 parent ce51da6 commit 290266e

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

drivers/md/md-linear.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,10 +189,9 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
189189
rdev->raid_disk = rdev->saved_raid_disk;
190190
rdev->saved_raid_disk = -1;
191191

192-
newconf = linear_conf(mddev,mddev->raid_disks+1);
193-
194-
if (!newconf)
195-
return -ENOMEM;
192+
newconf = linear_conf(mddev, mddev->raid_disks + 1);
193+
if (IS_ERR(newconf))
194+
return PTR_ERR(newconf);
196195

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

0 commit comments

Comments
 (0)