summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--kexec/arch/ppc64/fs2dt.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/kexec/arch/ppc64/fs2dt.c b/kexec/arch/ppc64/fs2dt.c
index 30b785f..a48cf23 100644
--- a/kexec/arch/ppc64/fs2dt.c
+++ b/kexec/arch/ppc64/fs2dt.c
@@ -111,7 +111,7 @@ static unsigned propnum(const char *name)
static void add_usable_mem_property(int fd, int len)
{
char fname[MAXPATH], *bname;
- char buf[MAXBYTES +1];
+ unsigned long long buf[2];
unsigned long ranges[2*MAX_MEMORY_RANGES];
unsigned long long base, end, loc_base, loc_end;
int range, rlen = 0;
@@ -123,6 +123,10 @@ static void add_usable_mem_property(int fd, int len)
if (strncmp(bname, "/memory@", 8))
return;
+ if (len < 2 * sizeof(unsigned long long))
+ die("unrecoverable error: not enough data for mem property\n");
+ len = 2 * sizeof(unsigned long long);
+
if (lseek(fd, 0, SEEK_SET) < 0)
die("unrecoverable error: error seeking in \"%s\": %s\n",
pathname, strerror(errno));