[Crosstoolchain-logs] [device-tree-compiler] 301/357: Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3.

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:06:25 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.3.x
in repository device-tree-compiler.

commit b236893fc4bc173877adfa4270b14d7d7209fb10
Author: Jon Loeliger <jdl at freescale.com>
Date:   Thu Sep 25 11:02:17 2008 -0500

    Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3.
    
    Using Gcc 4.3 detected this problem:
    
        ../dtc/libfdt/fdt.c: In function 'fdt_next_tag':
        ../dtc/libfdt/fdt.c:82: error: assuming signed overflow does not
        occur when assuming that (X + c) < X is always false
    
    To fix the problem, treat the offset as an unsigned int.
    
    The problem report and proposed fix were provided
    by Steve Papacharalambous <stevep at freescale.com>.
    
    Signed-off-by: Jon Loeliger <jdl at freescale.com>
---
 libfdt/fdt.c    | 2 +-
 libfdt/libfdt.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libfdt/fdt.c b/libfdt/fdt.c
index 2acaec5..37085c1 100644
--- a/libfdt/fdt.c
+++ b/libfdt/fdt.c
@@ -74,7 +74,7 @@ int fdt_check_header(const void *fdt)
 	return 0;
 }
 
-const void *fdt_offset_ptr(const void *fdt, int offset, int len)
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len)
 {
 	const char *p;
 
diff --git a/libfdt/libfdt.h b/libfdt/libfdt.h
index 9e4f990..60dd4a1 100644
--- a/libfdt/libfdt.h
+++ b/libfdt/libfdt.h
@@ -122,7 +122,7 @@
 /* Low-level functions (you probably don't need these)                */
 /**********************************************************************/
 
-const void *fdt_offset_ptr(const void *fdt, int offset, int checklen);
+const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int checklen);
 static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
 {
 	return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list