> -----Original Message----- > From: Johannes Thumshirn [mailto:jthumshirn@xxxxxxx] > Sent: Wednesday, February 15, 2017 12:32 AM > To: Raghava Aditya Renukunta > <RaghavaAditya.Renukunta@xxxxxxxxxxxxx>; jejb@xxxxxxxxxxxxxxxxxx; > martin.petersen@xxxxxxxxxx; linux-scsi@xxxxxxxxxxxxxxx > Cc: Dave Carroll <david.carroll@xxxxxxxxxxxxx>; Gana Sridaran > <gana.sridaran@xxxxxxxxxxxxx>; Scott Benesh > <scott.benesh@xxxxxxxxxxxxx>; dan.carpenter@xxxxxxxxxx > Subject: Re: [PATCH 05/16] aacraid: Fix memory leak in fib init path > > EXTERNAL EMAIL > > > On 02/14/2017 09:44 PM, Raghava Aditya Renukunta wrote: > > aac_fib_map_free frees misaligned fib dma memory, additionally it does > not > > free up the whole memory. > > > > Fixed by changing the code to free up the correct and full memory > > allocation. > > > > Cc: stable@xxxxxxxxxxxxxxx > > Fixes: e8b12f0fb835223 ([SCSI] aacraid: Add new code for PMC-Sierra's SRC > based controller family) > > Signed-off-by: Raghava Aditya Renukunta > <RaghavaAditya.Renukunta@xxxxxxxxxxxxx> > > Reviewed-by: David Carroll <David.Carroll@xxxxxxxxxxxxx> > > --- > > drivers/scsi/aacraid/commsup.c | 20 +++++++++----------- > > 1 file changed, 9 insertions(+), 11 deletions(-) > > > > diff --git a/drivers/scsi/aacraid/commsup.c > b/drivers/scsi/aacraid/commsup.c > > index f7a3bcb..863c98d 100644 > > --- a/drivers/scsi/aacraid/commsup.c > > +++ b/drivers/scsi/aacraid/commsup.c > > @@ -97,8 +97,8 @@ void aac_fib_map_free(struct aac_dev *dev) > > { > > if (dev->hw_fib_va && dev->max_cmd_size) { > > pci_free_consistent(dev->pdev, > > - (dev->max_cmd_size * > > - (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB)), > > + (dev->max_cmd_size + sizeof(struct aac_fib_xporthdr)) > > + * (dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB) + 31, > > dev->hw_fib_va, dev->hw_fib_pa); > > Can you please do something like: > > size_t alloc_size; > int numtags; > > numtags = dev->scsi_host_ptr->can_queue + AAC_NUM_MGT_FIB; > alloc_size = (dev->max_cmd_size + sizeof(struct aac_fib_xporthdr)) * > numtags + 31; > pci_free_consistent(dev->pdev, alloc_size, dev->hw_fib_va, > dev->hw_fib_pa); > > And please indent correctly. If it indentation doesn't work correctly > because you hit the 80 chars limit, that's a sign something should be > reconsidered. Yes, I will rework this. Regards, Raghava Aditya > Thanks, > Johannes > -- > Johannes Thumshirn Storage > jthumshirn@xxxxxxx +49 911 74053 689 > SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg > GF: Felix Imendörffer, Jane Smithard, Graham Norton > HRB 21284 (AG Nürnberg) > Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850