Merge changes from topic "presubmit-am-0c8d0f7eeff84fd08e46fd11542b2156" into sc-mainline-prod
* changes:
[automerge] FROMGIT: libfdt: fdt_offset_ptr(): Fix comparison warnings 2p: 6f0fef2b2a
FROMGIT: libfdt: fdt_offset_ptr(): Fix comparison warnings
This commit is contained in:
commit
96de87390d
1 changed files with 7 additions and 3 deletions
10
libfdt/fdt.c
10
libfdt/fdt.c
|
@ -134,16 +134,20 @@ int fdt_check_header(const void *fdt)
|
|||
|
||||
const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len)
|
||||
{
|
||||
unsigned absoffset = offset + fdt_off_dt_struct(fdt);
|
||||
unsigned int uoffset = offset;
|
||||
unsigned int absoffset = offset + fdt_off_dt_struct(fdt);
|
||||
|
||||
if (offset < 0)
|
||||
return NULL;
|
||||
|
||||
if (!can_assume(VALID_INPUT))
|
||||
if ((absoffset < offset)
|
||||
if ((absoffset < uoffset)
|
||||
|| ((absoffset + len) < absoffset)
|
||||
|| (absoffset + len) > fdt_totalsize(fdt))
|
||||
return NULL;
|
||||
|
||||
if (can_assume(LATEST) || fdt_version(fdt) >= 0x11)
|
||||
if (((offset + len) < offset)
|
||||
if (((uoffset + len) < uoffset)
|
||||
|| ((offset + len) > fdt_size_dt_struct(fdt)))
|
||||
return NULL;
|
||||
|
||||
|
|
Loading…
Reference in a new issue