diff mbox series

[next] md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add()

Message ID add654be-759f-4b2d-93ba-a3726dae380c@stanley.mountain (mailing list archive)
State Accepted
Headers show
Series [next] md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add() | expand

Checks

Context Check Description
mdraidci/vmtest-md-6_13-PR fail merge-conflict
mdraidci/vmtest-md-6_14-PR success PR summary
mdraidci/vmtest-md-6_14-VM_Test-0 success Logs for per-patch-testing

Commit Message

Dan Carpenter Jan. 15, 2025, 6:53 a.m. UTC
The linear_conf() returns error pointers, it doesn't return NULL.  Update
the error checking to match.

Fixes: 127186cfb184 ("md: reintroduce md-linear")
Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
---
 drivers/md/md-linear.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Yu Kuai Jan. 15, 2025, 7:31 a.m. UTC | #1
在 2025/01/15 14:53, Dan Carpenter 写道:
> The linear_conf() returns error pointers, it doesn't return NULL.  Update
> the error checking to match.
> 
> Fixes: 127186cfb184 ("md: reintroduce md-linear")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>   drivers/md/md-linear.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
LGTM
Reviewed-by: Yu Kuai <yukuai3@huawei.com>

> diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c
> index 53bc3fda9edb..a382929ce7ba 100644
> --- a/drivers/md/md-linear.c
> +++ b/drivers/md/md-linear.c
> @@ -204,8 +204,8 @@ static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
>   	rdev->saved_raid_disk = -1;
>   
>   	newconf = linear_conf(mddev, mddev->raid_disks + 1);
> -	if (!newconf)
> -		return -ENOMEM;
> +	if (IS_ERR(newconf))
> +		return PTR_ERR(newconf);
>   
>   	/* newconf->raid_disks already keeps a copy of * the increased
>   	 * value of mddev->raid_disks, WARN_ONCE() is just used to make
>
diff mbox series

Patch

diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c
index 53bc3fda9edb..a382929ce7ba 100644
--- a/drivers/md/md-linear.c
+++ b/drivers/md/md-linear.c
@@ -204,8 +204,8 @@  static int linear_add(struct mddev *mddev, struct md_rdev *rdev)
 	rdev->saved_raid_disk = -1;
 
 	newconf = linear_conf(mddev, mddev->raid_disks + 1);
-	if (!newconf)
-		return -ENOMEM;
+	if (IS_ERR(newconf))
+		return PTR_ERR(newconf);
 
 	/* newconf->raid_disks already keeps a copy of * the increased
 	 * value of mddev->raid_disks, WARN_ONCE() is just used to make