Re: possible over-allocation in target_fabric_make_lun

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

 



On Thu, 2014-01-30 at 15:05 -0500, Dave Jones wrote:
> On Thu, Jan 30, 2014 at 11:43:51AM -0800, Nicholas A. Bellinger wrote:
>  
>  > 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.
> 
> There's a bunch of other bugs that coverity found in target/
> If you (or anyone else) wants to sign up at http://scan.coverity.com
> I can approve your access.  Having someone aware of what's queued
> looking over them is going to save a lot of duplicated work.
> 

Signed up, and waiting for the confirmation email now..

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