Re: possible over-allocation in target_fabric_make_lun

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Dave,

On Wed, 2014-01-29 at 21:13 -0500, Dave Jones wrote:
> Does the patch below make sense ?
> 
> I noticed coverity complaining this looked odd that we were allocating some 336 longs when
> target_stat_setup_port_default_groups seems to write just 4 pointers.
> 
> Signed-off-by: Dave Jones <davej@xxxxxxxxxxxxxxxxx>
> 
> diff --git a/drivers/target/target_core_fabric_configfs.c b/drivers/target/target_core_fabric_configfs.c
> index dae2ad6a669e..7de9f0475d05 100644
> --- a/drivers/target/target_core_fabric_configfs.c
> +++ b/drivers/target/target_core_fabric_configfs.c
> @@ -906,7 +906,7 @@ static struct config_group *target_fabric_make_lun(
>  	lun_cg->default_groups[1] = NULL;
>  
>  	port_stat_grp = &lun->port_stat_grps.stat_group;
> -	port_stat_grp->default_groups =  kzalloc(sizeof(struct config_group) * 3,
> +	port_stat_grp->default_groups =  kzalloc(sizeof(struct config_group *) * 4,
>  				GFP_KERNEL);
>  	if (!port_stat_grp->default_groups) {
>  		pr_err("Unable to allocate port_stat_grp->default_groups\n");

So a patch for this is currently queued for v3.14-rc1 code:

target: Fix sizeof in kmalloc for some default_groups arrays
https://git.kernel.org/cgit/linux/kernel/git/nab/target-pending.git/commit/?h=for-next&id=ab6dae8236767f9815bb00c29a56d045e33cd470

Regardless, thanks for the extra heads up.

--nab

--
To unsubscribe from this list: send the line "unsubscribe target-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux SCSI]     [Kernel Newbies]     [Linux SCSI Target Infrastructure]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Device Mapper]

  Powered by Linux