Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

target: Fix sizeof in kmalloc for some default_groups arrays

Allocating an array of pointers, not the objects themselves. These two
sites now match all the other sites.

Signed-off-by: Andy Grover <agrover@redhat.com>
Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>

authored by

Andy Grover and committed by
Nicholas Bellinger
ab6dae82 3f0ed57b

+2 -2
+1 -1
drivers/target/target_core_configfs.c
··· 2937 2937 * and ALUA Logical Unit Group and Target Port Group infrastructure. 2938 2938 */ 2939 2939 target_cg = &subsys->su_group; 2940 - target_cg->default_groups = kmalloc(sizeof(struct config_group) * 2, 2940 + target_cg->default_groups = kmalloc(sizeof(struct config_group *) * 2, 2941 2941 GFP_KERNEL); 2942 2942 if (!target_cg->default_groups) { 2943 2943 pr_err("Unable to allocate target_cg->default_groups\n");
+1 -1
drivers/target/target_core_fabric_configfs.c
··· 906 906 lun_cg->default_groups[1] = NULL; 907 907 908 908 port_stat_grp = &lun->port_stat_grps.stat_group; 909 - port_stat_grp->default_groups = kzalloc(sizeof(struct config_group) * 4, 909 + port_stat_grp->default_groups = kzalloc(sizeof(struct config_group *) * 4, 910 910 GFP_KERNEL); 911 911 if (!port_stat_grp->default_groups) { 912 912 pr_err("Unable to allocate port_stat_grp->default_groups\n");