Skip to contentSkip to conversation

md/raid10: check for ERR_PTR returns from setup_conf()

PATCH In review Dan Carpenter 2 participants 2 messages May 25, 2010

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 md/raid10: check for ERR_PTR returns from setup_conf()

setup_conf() can return error values so I added a check for that here.

drivers/md/raid10.c +2 -0
index 0372499..8bd7da2 100644
@@ -2454,6 +2454,8 @@ static void *raid10_takeover_raid0(mddev_t *mddev)
 	mddev->recovery_cp = MaxSector;
 
 	conf = setup_conf(mddev);
+	if (IS_ERR(conf))
+		return conf;
 	conf->scale_disks = 2;
 	return conf;
 }
#1 lore raw
Quoted 9 lines · Dan Carpenter

setup_conf() can return error values so I added a check for that here.

drivers/md/raid10.c +0 -0
index 0372499..8bd7da2 100644

drivers/md/raid10.c static void *raid10_takeover_raid0(mddev_t *mddev) · line 2461

Quoted 8 lines
drivers/md/raid10.c +2 -0
@@ -2454,6 +2454,8 @@ static void *raid10_takeover_raid0(mddev_t *mddev)
 	mddev->recovery_cp = MaxSector;
 
 	conf = setup_conf(mddev);
+	if (IS_ERR(conf))
+		return conf;
 	conf->scale_disks = 2;
 	return conf;
 }

Looks good. Feel free to add my Acked-By.

BTW: setup_conf() could use some cleanup: The "couldn't allocate memory" error message at the bottom is misleading, and the function returns ERR_PTR(-ENOMEM) also if md_register_thread() fails.

Here's a question for Neil: raid10_takeover_raid0() sets mddev->new_layout, but setup_conf() uses the old values of the raid0. How is this supposed to work?

Thanks
Andre

Signature · 1 line
The only person who always got his work done by Friday was Robinson Crusoe