* [U-Boot] [PATCH 2/3] Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3.
@ 2008-10-02 2:03 Jerry Van Baren
2008-10-02 2:14 ` [U-Boot] s/3/2/ [PATCH 2/3]/ " Jerry Van Baren
0 siblings, 1 reply; 2+ messages in thread
From: Jerry Van Baren @ 2008-10-02 2:03 UTC (permalink / raw)
To: u-boot
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@freescale.com>.
Signed-off-by: Jon Loeliger <jdl@freescale.com>
---
include/libfdt.h | 2 +-
libfdt/fdt.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/include/libfdt.h b/include/libfdt.h
index 94c35e3..5492a53 100644
--- a/include/libfdt.h
+++ b/include/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);
diff --git a/libfdt/fdt.c b/libfdt/fdt.c
index 732103b..a59a518 100644
--- a/libfdt/fdt.c
+++ b/libfdt/fdt.c
@@ -78,7 +78,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;
--
1.5.6.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-10-02 2:14 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-10-02 2:03 [U-Boot] [PATCH 2/3] Fix an overflow case in fdt_offset_ptr() detected by GCC 4.3 Jerry Van Baren
2008-10-02 2:14 ` [U-Boot] s/3/2/ [PATCH 2/3]/ " Jerry Van Baren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox