target/configfs: allocate only 6 slots for dev_cg->default_groups
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Wed, 28 Nov 2012 01:49:44 +0000 (17:49 -0800)
committerNicholas Bellinger <nab@linux-iscsi.org>
Wed, 28 Nov 2012 06:49:23 +0000 (22:49 -0800)
Only slots 0-5 are used so 6 slots should be enough. I don't see anyone
writting anything else than NULL into ->default_groups[5] so a "late"
initialisation should not happen here.

(nab: Fix up minor apply breakage in for-next)

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
drivers/target/target_core_configfs.c

index 02fd55d3a76eac3f3aacc34a31ce208bceb57005..f6fc258b9d40de9b72557342cc780190e1fcdc90 100644 (file)
@@ -2496,7 +2496,7 @@ static struct config_group *target_core_make_subdev(
 
        dev_cg = &dev->dev_group;
 
-       dev_cg->default_groups = kzalloc(sizeof(struct config_group *) * 7,
+       dev_cg->default_groups = kzalloc(sizeof(struct config_group *) * 6,
                        GFP_KERNEL);
        if (!dev_cg->default_groups)
                goto out_free_device;