public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Kristen Accardi <kristen.c.accardi@intel.com>
To: Kenji Kaneshige <kaneshige.kenji@jp.fujitsu.com>
Cc: pcihpd-discuss@lists.sourceforge.net,
	linux-kernel@vger.kernel.org, greg@kroah.com
Subject: Re: [Pcihpd-discuss] [patch] pci hotplug: add common acpi functions to core
Date: Wed, 01 Mar 2006 14:56:30 -0800	[thread overview]
Message-ID: <1141253790.13333.34.camel@whizzy> (raw)
In-Reply-To: <44050100.8070003@jp.fujitsu.com>

On Wed, 2006-03-01 at 11:03 +0900, Kenji Kaneshige wrote:
> Hi Kristen,
> 
> This looks very nice to me!
> 
> Here is one comment.
> 
> > +int is_root_bridge(acpi_handle handle)
> > +{
> > +	acpi_status status;
> > +	struct acpi_device_info *info;
> > +	struct acpi_buffer buffer = {ACPI_ALLOCATE_BUFFER, NULL};
> > +	int i;
> > +
> > +	status = acpi_get_object_info(handle, &buffer);
> > +	if (ACPI_SUCCESS(status)) {
> > +		info = buffer.pointer;
> > +		if ((info->valid & ACPI_VALID_HID) &&
> > +			!strcmp(PCI_ROOT_HID_STRING,
> > +					info->hardware_id.value)) {
> > +			acpi_os_free(buffer.pointer);
> > +			return 1;
> > +		}
> > +		if (info->valid & ACPI_VALID_CID) {
> > +			for (i=0; i < info->compatibility_id.count; i++) {
> > +				if (!strcmp(PCI_ROOT_HID_STRING,
> > +					info->compatibility_id.id[i].value)) {
> > +					acpi_os_free(buffer.pointer);
> > +					return 1;
> > +				}
> > +			}
> > +		}
> > +	}
> > +	return 0;
> > +}
> > +EXPORT_SYMBOL_GPL(is_root_bridge);
> 
> I think this seems to leak memory (buffer.pointer), though
> I guess you just copy and paste from the original code. I think
> we need to free buffer.pointer whenever acpi_get_object_info()
> returns as success.
> 
> Thanks,
> Kenji Kaneshige

Ah hah, you are right.  Yes, I did just cut and paste the original code
- and this just makes me happy I'm doing this because this bug is
currently duplicated in 2 drivers since they all cut and pasted the same
buggy code.  Soon we will just share the same 1 piece of buggy code.



  reply	other threads:[~2006-03-01 22:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-01  0:46 [patch] pci hotplug: add common acpi functions to core Kristen Accardi
2006-03-01  0:53 ` Greg KH
2006-03-01  2:01 ` Randy.Dunlap
2006-03-01  2:03 ` [Pcihpd-discuss] " Kenji Kaneshige
2006-03-01 22:56   ` Kristen Accardi [this message]
2006-03-01  2:42 ` Kenji Kaneshige
2006-03-01 22:42   ` Kristen Accardi
2006-03-02  3:18     ` Kenji Kaneshige
2006-03-02 23:38       ` Kristen Accardi
2006-03-03 18:16 ` [patch] pci hotplug: add common acpi functions to core v2 Kristen Accardi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1141253790.13333.34.camel@whizzy \
    --to=kristen.c.accardi@intel.com \
    --cc=greg@kroah.com \
    --cc=kaneshige.kenji@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pcihpd-discuss@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox