Patchwork [Bug,656285] Re: arm-semi mishandling SYS_HEAPINFO

login
register
mail settings
Submitter Brian Harring
Date Nov. 27, 2010, 8:47 p.m.
Message ID <20101127204743.5544.37859.malone@potassium.ubuntu.com>
Download mbox | patch
Permalink /patch/73299/
State New
Headers show

Comments

Brian Harring - Nov. 27, 2010, 8:47 p.m.
Pardon, badly phrased on my part- basically we can get either -1 or old.
If we changed that conditional w/in arm-semi.c to:

if (-1 != limit && limit != ts->heap_base) {

that should do the trick in a cross platform way, although we'll have to
tweak the for loop to handle when limit degrades to 0.  Note that this
isn't the only spot that has the -1 assumption- m68-semi.c is the same.
Also, linux-user/m68k-sim.c looks a bit odd in light of this discussion
(that one I don't quite get- it checks for -ENOMEM which is supposed to
be an alpha only return).

Patch

--- arm-semi.c.orig     2010-09-21 13:19:15.000000000 +0100
+++ arm-semi.c  2010-10-07 13:23:13.000000000 +0100
@@ -475,7 +475,7 @@ 
                 /* Try a big heap, and reduce the size if that fails.  */
                 for (;;) {
                     ret = do_brk(limit);
-                    if (ret != -1)
+                    if (ret == limit)
                         break;
                     limit = (ts->heap_base >> 1) + (limit >> 1);
                 }