mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-13 16:27:39 -04:00
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@freescale.com>. Signed-off-by: Jon Loeliger <jdl@freescale.com>
This commit is contained in:
parent
8daae14b74
commit
b236893fc4
2 changed files with 2 additions and 2 deletions
|
@ -74,7 +74,7 @@ int fdt_check_header(const void *fdt)
|
||||||
return 0;
|
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;
|
const char *p;
|
||||||
|
|
||||||
|
|
|
@ -122,7 +122,7 @@
|
||||||
/* Low-level functions (you probably don't need these) */
|
/* 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)
|
static inline void *fdt_offset_ptr_w(void *fdt, int offset, int checklen)
|
||||||
{
|
{
|
||||||
return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
|
return (void *)(uintptr_t)fdt_offset_ptr(fdt, offset, checklen);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue