x86: Do not free zero sized per cpu areas
authorIan Campbell <[email protected]>
Mon, 29 Mar 2010 02:42:56 +0000 (19:42 -0700)
committerIngo Molnar <[email protected]>
Mon, 29 Mar 2010 16:55:40 +0000 (18:55 +0200)
This avoids an infinite loop in free_early_partial().

Add a warning to free_early_partial() to catch future problems.

-v5: put back start > end back into WARN_ONCE()
-v6: use one line for warning, suggested by Linus
-v7: more tests
-v8: remove the function name as suggested by Johannes
     WARN_ONCE() will print out that function name.

Signed-off-by: Ian Campbell <[email protected]>
Signed-off-by: Yinghai Lu <[email protected]>
Tested-by: Konrad Rzeszutek Wilk <[email protected]>
Tested-by: Joel Becker <[email protected]>
Tested-by: Stanislaw Gruszka <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: David Miller <[email protected]>
Cc: Benjamin Herrenschmidt <[email protected]>
Cc: Linus Torvalds <[email protected]>
LKML-Reference: <1269830604[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
kernel/early_res.c

index 3cb2c661bb781ab5468a54e58a106cdb14269a7b..31aa9332ef3f8d4f5447f72a3989cbfd0dc7c6df 100644 (file)
@@ -333,6 +333,12 @@ void __init free_early_partial(u64 start, u64 end)
        struct early_res *r;
        int i;
 
+       if (start == end)
+               return;
+
+       if (WARN_ONCE(start > end, "  wrong range [%#llx, %#llx]\n", start, end))
+               return;
+
 try_next:
        i = find_overlapped_early(start, end);
        if (i >= max_early_res)