Re: [uml-devel] "resource: provide new functions to walk through resources" breaks UML

From: Toralf FÃrster
Date: Mon Aug 11 2014 - 15:25:32 EST


On 08/11/2014 08:44 PM, Vivek Goyal wrote:
>
> Hi Richard,
>
> Can you please give the attached patch a try and see if it fixes the UML
> issue.
>
> I noticed that previous code had a for() loop which will not execute
> if p was null. I have resorted back to same code now.
>
> Thanks
> Vivek
>
>
> ---
> kernel/resource.c | 11 ++++-------
> 1 file changed, 4 insertions(+), 7 deletions(-)
>
> Index: linux-2.6/kernel/resource.c
> ===================================================================
> --- linux-2.6.orig/kernel/resource.c 2014-08-11 13:36:19.942423192 -0400
> +++ linux-2.6/kernel/resource.c 2014-08-11 13:50:20.529387653 -0400
> @@ -351,15 +351,12 @@ static int find_next_iomem_res(struct re
> end = res->end;
> BUG_ON(start >= end);
>
> - read_lock(&resource_lock);
> -
> - if (first_level_children_only) {
> - p = iomem_resource.child;
> + if (first_level_children_only)
> sibling_only = true;
> - } else
> - p = &iomem_resource;
>
> - while ((p = next_resource(p, sibling_only))) {
> + read_lock(&resource_lock);
> +
> + for (p = iomem_resource.child; p; p = next_resource(p, sibling_only)) {
> if (p->flags != res->flags)
> continue;
> if (name && strcmp(p->name, name))
>
At least at my system (32 bit x86) the patch seems to work (applied on top of v3.16-10473-gc8d6637)

--
Toralf

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