Make sure that base and end do not overflow

Signed-off-by: Simon Horman <[EMAIL PROTECTED]>

Index: kexec-tools-testing/kexec/arch/ppc64/fs2dt.c
===================================================================
--- kexec-tools-testing.orig/kexec/arch/ppc64/fs2dt.c   2006-12-11 
13:22:09.000000000 +0900
+++ kexec-tools-testing/kexec/arch/ppc64/fs2dt.c        2006-12-11 
13:24:11.000000000 +0900
@@ -137,8 +137,10 @@
                die("unrecoverable error: error reading \"%s\": %s\n",
                    pathname, strerror(errno));
 
-       base = ((unsigned long long *)buf)[0];
-       end = base + ((unsigned long long *)buf)[1];
+       if (~0ULL - buf[0] < buf[1])
+               die("unrecoverable error: mem property overflow\n");
+       base = buf[0];
+       end = base + buf[1];
 
        for (range = 0; range < usablemem_rgns.size; range++) {
                loc_base = usablemem_rgns.ranges[range].start;

--

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to