Re: [Pcihpd-discuss] [patch] pci hotplug: add common acpi functions to core

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

 



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.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux