[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1332987958-10766-1-git-send-email-lauraa@codeaurora.org>
Date: Wed, 28 Mar 2012 19:25:58 -0700
From: Laura Abbott <lauraa@...eaurora.org>
To: linux-mm@...ck.org, benh@...nel.crashing.org, yinghai@...nel.org
Cc: linux-kernel@...r.kernel.org, linux-arm-msm@...r.kernel.org,
Laura Abbott <lauraa@...eaurora.org>
Subject: [PATCH] mm/memblock.c: Correctly check whether to trim a block
Currently in __memblock_remove, the check to trim the top of
a block off only checks if the requested base is less than the
memblock end. If the end of the requested region is equal to
the start of a memblock, this will incorrectly try to remove
the block, possibly causing an integer underflow:
---------------------------------------
| | |
| | |
base end = rgn->base rend
An additional check is needed to see if the end of the requested
region is greater than the memblock region:
----------------------
| |
| |
rgn->base base rend end
| |
| |
--------------------
Signed-off-by: Laura Abbott <lauraa@...eaurora.org>
---
mm/memblock.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/mm/memblock.c b/mm/memblock.c
index 5338237..e174ee0 100644
--- a/mm/memblock.c
+++ b/mm/memblock.c
@@ -459,7 +459,7 @@ static long __init_memblock __memblock_remove(struct memblock_type *type,
}
/* And check if we need to trim the top of a block */
- if (base < rend)
+ if (base < rend && end > rend)
rgn->size -= rend - base;
}
--
1.7.8.3
--
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