lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <PH7PR11MB5862175ABA605BAB7FF62E0EF7A69@PH7PR11MB5862.namprd11.prod.outlook.com>
Date:   Fri, 10 Jun 2022 06:57:27 +0000
From:   "Mohan, Subramanian" <subramanian.mohan@...el.com>
To:     Bjorn Helgaas <helgaas@...nel.org>
CC:     "nirmal.patel@...ux.intel.com" <nirmal.patel@...ux.intel.com>,
        "jonathan.derrick@...ux.dev" <jonathan.derrick@...ux.dev>,
        "lorenzo.pieralisi@....com" <lorenzo.pieralisi@....com>,
        "robh@...nel.org" <robh@...nel.org>, "kw@...ux.com" <kw@...ux.com>,
        "bhelgaas@...gle.com" <bhelgaas@...gle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>,
        "Sangannavar, Mallikarjunappa" 
        <mallikarjunappa.sangannavar@...el.com>,
        "Thokala, Srikanth" <srikanth.thokala@...el.com>
Subject: RE: [PATCH] PCI: vmd: Use devm_kasprintf instead of simple kasprintf

Hi Bjorn, 


> -----Original Message-----
> From: Mohan, Subramanian
> Sent: Wednesday, June 1, 2022 4:45 PM
> To: Bjorn Helgaas <helgaas@...nel.org>
> Cc: nirmal.patel@...ux.intel.com; jonathan.derrick@...ux.dev;
> lorenzo.pieralisi@....com; robh@...nel.org; kw@...ux.com;
> bhelgaas@...gle.com; linux-kernel@...r.kernel.org; linux-
> pci@...r.kernel.org; Sangannavar, Mallikarjunappa
> <mallikarjunappa.sangannavar@...el.com>; Thokala, Srikanth
> <Srikanth.Thokala@...el.com>
> Subject: RE: [PATCH] PCI: vmd: Use devm_kasprintf instead of simple kasprintf
> 
> 
> 
> > -----Original Message-----
> > From: Bjorn Helgaas <helgaas@...nel.org>
> > Sent: Wednesday, June 1, 2022 12:09 AM
> > To: Mohan, Subramanian <subramanian.mohan@...el.com>
> > Cc: nirmal.patel@...ux.intel.com; jonathan.derrick@...ux.dev;
> > lorenzo.pieralisi@....com; robh@...nel.org; kw@...ux.com;
> > bhelgaas@...gle.com; linux-kernel@...r.kernel.org; linux-
> > pci@...r.kernel.org; Sangannavar, Mallikarjunappa
> > <mallikarjunappa.sangannavar@...el.com>; Thokala, Srikanth
> > <srikanth.thokala@...el.com>
> > Subject: Re: [PATCH] PCI: vmd: Use devm_kasprintf instead of simple
> > kasprintf
> >
> > On Tue, May 31, 2022 at 06:56:17PM +0530, subramanian.mohan@...el.com
> > wrote:
> > > From: Subramanian Mohan <subramanian.mohan@...el.com>
> > >
> > > Use devm_kasprintf instead of simple kasprintf to free the allocated
> > > memory automatically when the device is freed.
> >
> > I guess this is pure simplification, not a bug fix, since we *did*
> > free the buffer in the error path and in vmd_remove(), right?
> >
> 
> Yes this is simplification and not bug fix.

Gentle reminder, kindly let me know any further comments.

> 
> Thanks,
> Subbu
> 
> > > Suggested-by: Srikanth Thokala <srikanth.thokala@...el.com>
> > > Signed-off-by: Subramanian Mohan <subramanian.mohan@...el.com>
> > > Acked-by: Nirmal Patel <nirmal.patel@...ux.intel.com>
> > > ---
> > >  drivers/pci/controller/vmd.c | 5 ++---
> > >  1 file changed, 2 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/drivers/pci/controller/vmd.c
> > > b/drivers/pci/controller/vmd.c index eb05cceab964..7a72948e001f
> > > 100644
> > > --- a/drivers/pci/controller/vmd.c
> > > +++ b/drivers/pci/controller/vmd.c
> > > @@ -897,7 +897,8 @@ static int vmd_probe(struct pci_dev *dev, const
> > struct pci_device_id *id)
> > >  	if (vmd->instance < 0)
> > >  		return vmd->instance;
> > >
> > > -	vmd->name = kasprintf(GFP_KERNEL, "vmd%d", vmd->instance);
> > > +	vmd->name = devm_kasprintf(&dev->dev, GFP_KERNEL, "vmd%d",
> > > +				   vmd->instance);
> > >  	if (!vmd->name) {
> > >  		err = -ENOMEM;
> > >  		goto out_release_instance;
> > > @@ -935,7 +936,6 @@ static int vmd_probe(struct pci_dev *dev, const
> > > struct pci_device_id *id)
> > >
> > >   out_release_instance:
> > >  	ida_simple_remove(&vmd_instance_ida, vmd->instance);
> > > -	kfree(vmd->name);
> > >  	return err;
> > >  }
> > >
> > > @@ -958,7 +958,6 @@ static void vmd_remove(struct pci_dev *dev)
> > >  	vmd_detach_resources(vmd);
> > >  	vmd_remove_irq_domain(vmd);
> > >  	ida_simple_remove(&vmd_instance_ida, vmd->instance);
> > > -	kfree(vmd->name);
> > >  }
> > >
> > >  #ifdef CONFIG_PM_SLEEP
> > > --
> > > 2.17.1
> > >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ