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] [day] [month] [year] [list]
Message-ID: <4B2ED310.1070709@kernel.org>
Date:	Sun, 20 Dec 2009 17:44:48 -0800
From:	Yinghai Lu <yinghai@...nel.org>
To:	Bjorn Helgaas <bjorn.helgaas@...com>
CC:	Jesse Barnes <jbarnes@...tuousgeek.org>,
	Ingo Molnar <mingo@...e.hu>,
	Linus Torvalds <torvalds@...ux-foundation.org>,
	Ivan Kokshaysky <ink@...assic.park.msu.ru>,
	Kenji Kaneshige <kaneshige.kenji@...fujitsu.com>,
	Alex Chiang <achiang@...com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-pci@...r.kernel.org" <linux-pci@...r.kernel.org>
Subject: Re: [PATCH 4/12] pci: add failed_list to record failed one for	pci_bus_assign_resources
 -v2

Bjorn Helgaas wrote:
> On Fri, 2009-12-18 at 12:55 -0800, Yinghai Lu wrote:
>> so later we can do sth with those failed one
>>
>> -v2: store start, end, flags aside. so could keep res cleared when assign
>>      failed. and make following assignment of its children do not go wild
>>
>> Signed-off-by: Yinghai Lu <yinghai@...nel.org>
>>
>> ---
>>  drivers/pci/setup-bus.c |   66 +++++++++++++++++++++++++++++++++++++++++++++---
>>  1 file changed, 62 insertions(+), 4 deletions(-)
>>
>> Index: linux-2.6/drivers/pci/setup-bus.c
>> ===================================================================
>> --- linux-2.6.orig/drivers/pci/setup-bus.c
>> +++ linux-2.6/drivers/pci/setup-bus.c
>> @@ -27,7 +27,52 @@
>>  #include <linux/slab.h>
>>  #include "pci.h"
>>  
>> -static void pbus_assign_resources_sorted(const struct pci_bus *bus)
>> +struct resource_list_x {
>> +	struct resource_list_x *next;
>> +	struct resource *res;
>> +	struct pci_dev *dev;
>> +	resource_size_t start;
>> +	resource_size_t end;
>> +	unsigned long flags;
>> +};
>> +
>> +static void add_to_failed_list(struct resource_list_x *head,
>> +				 struct pci_dev *dev, struct resource *res)
>> +{
>> +	struct resource_list_x *list = head;
>> +	struct resource_list_x *ln = list->next;
>> +	struct resource_list_x *tmp;
>> +
>> +	tmp = kmalloc(sizeof(*tmp), GFP_KERNEL);
>> +	if (!tmp) {
>> +		pr_warning("add_to_failed_list: kmalloc() failed!\n");
>> +		return;
>> +	}
>> +
>> +	tmp->next = ln;
>> +	tmp->res = res;
>> +	tmp->dev = dev;
>> +	tmp->start = res->start;
>> +	tmp->end = res->end;
>> +	tmp->flags = res->flags;
>> +	list->next = tmp;
>> +}
>> +
>> +static void free_failed_list(struct resource_list_x *head)
>> +{
>> +	struct resource_list_x *list, *tmp;
>> +
>> +	for (list = head->next; list;) {
>> +		tmp = list;
>> +		list = list->next;
>> +		kfree(tmp);
>> +	}
>> +
>> +	head->next = NULL;
>> +}
> 
> This patch adds a call to add_to_failed_list(), but no call to
> free_failed_list(), so at first glance, this patch appears to introduce
> a leak.  I see that it actually doesn't because you pass around a NULL
> 'fail_head', so you never actually call add_to_failed_list(), but it
> would make more sense if you added the alloc and matching free in a
> single patch.

free_failed_list will free them all.


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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ