Thread (4 messages) 4 messages, 2 authors, 2006-12-22

Re: [powerpc] Fix bogus BUG_ON() in in hugetlb_get_unmapped_area()

From: David Gibson <hidden>
Date: 2006-12-22 02:17:57
Also in: lkml

On Fri, Dec 22, 2006 at 01:31:26AM +0100, Segher Boessenkool wrote:
quoted
+	if (len > TASK_SIZE)
+		return -ENOMEM;
Shouldn't that be addr+len instead?  The check looks incomplete
otherwise.  And you meant ">=" I guess?
No.  Have a look at the other hugetlb_get_unmapped_area()
implementations.  Because this is in the get_unmapped_area() path,
'addr' is just a hint, so checking addr+len would give bogus
failures.  This test is, I believe, essentially an optimization - if
it fails, we're never going to find a suitable addr, so we might as
well give up now.
quoted
-		/* Paranoia, caller should have dealt with this */
-		BUG_ON((addr + len) > 0x100000000UL);
-
Any real reason to remove the paranoia check?  If it's trivially
always satisfied, the compiler will get rid of it for you :-)
Yes - this is the very bug on which was causing crashes - the "caller
should have dealt with this" comment is wrong.  The test has been
moved into htlb_check_hinted_area() and now simply fails (and so falls
back to searching for a suitable address), rather than BUG()ing.

-- 
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help