summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew McClintock <msm@freescale.com>2010-08-18 23:56:50 -0500
committerSimon Horman <horms@verge.net.au>2010-08-20 17:26:46 +0900
commit5265793bd259c0fe0522df88eb6f20139188887a (patch)
tree65482d17e431c867fc4d7d31127a6c75e3277cc8
parenta3e6598138d5b6c34f94b9c036737be8b0249aa3 (diff)
Prevent multiple reservations for cpu-release-addr
Currently, we can add a lot of reservations over a small range, this does a simple check to verify the previous entry is not the same as the current one and skips it if so Signed-off-by: Matthew McClintock <msm@freescale.com> Signed-off-by: Simon Horman <horms@verge.net.au>
-rw-r--r--kexec/arch/ppc/fixup_dtb.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index 09f9ac1..910a3f0 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -139,6 +139,7 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t
{
int ret, i;
int nodeoffset;
+ u64 val = 0;
/* If this is a KEXEC kernel we add all regions since they will
* all need to be saved */
@@ -175,20 +176,25 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t
while (nodeoffset != -FDT_ERR_NOTFOUND) {
const void *buf;
int sz, ret;
- u64 val = 0;
+ u64 tmp;
buf = fdt_getprop(blob_buf, nodeoffset, "cpu-release-addr", &sz);
- if (sz == 4) {
- val = *(u32 *)buf;
- } else if (sz == 8) {
- val = *(u64 *)buf;
- }
- if (val) {
- ret = fdt_add_mem_rsv(blob_buf, PAGE_ALIGN(val-PAGE_SIZE), PAGE_SIZE);
- if (ret)
- printf("%s: Unable to add reserve for cpu-release-addr!\n",
- fdt_strerror(ret));
+ if (buf) {
+ if (sz == 4) {
+ tmp = *(u32 *)buf;
+ } else if (sz == 8) {
+ tmp = *(u64 *)buf;
+ }
+
+ /* crude check to see if last value is repeated */
+ if (_ALIGN_DOWN(tmp, PAGE_SIZE) != _ALIGN_DOWN(val, PAGE_SIZE)) {
+ val = tmp;
+ ret = fdt_add_mem_rsv(blob_buf, _ALIGN_DOWN(val, PAGE_SIZE), PAGE_SIZE);
+ if (ret)
+ printf("%s: Unable to add reserve for cpu-release-addr!\n",
+ fdt_strerror(ret));
+ }
}
nodeoffset = fdt_node_offset_by_prop_value(blob_buf, nodeoffset,