mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH next] md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add()
@ 2025-01-15  6:53 Dan Carpenter
  2025-01-15  7:31 ` Yu Kuai
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2025-01-15  6:53 UTC (permalink / raw)
  To: Yu Kuai
  Cc: Song Liu, Coly Li, Mike Snitzer, linux-raid, linux-kernel,
	kernel-janitors

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(-)

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
-- 
2.45.2


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-15  7:31 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-15  6:53 [PATCH next] md/md-linear: Fix a NULL vs IS_ERR() bug in linear_add() Dan Carpenter
2025-01-15  7:31 ` Yu Kuai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®