Merge "FROMGIT: libfdt: fdt_offset_ptr(): Fix comparison warnings" into qt-dev am: d78db83214
Original change: https://googleplex-android-review.googlesource.com/c/platform/external/dtc/+/19527649 Change-Id: I4cb6f3b054cbd1c06e674f32d55f6cdb9f52cd5e Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
a2f57e7e7e
1 changed files with 7 additions and 3 deletions
10
libfdt/fdt.c
10
libfdt/fdt.c
|
@ -76,15 +76,19 @@ int fdt_check_header(const void *fdt)
|
||||||
|
|
||||||
const void *fdt_offset_ptr(const void *fdt, int offset, unsigned int len)
|
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 ((absoffset < offset)
|
if (offset < 0)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if ((absoffset < uoffset)
|
||||||
|| ((absoffset + len) < absoffset)
|
|| ((absoffset + len) < absoffset)
|
||||||
|| (absoffset + len) > fdt_totalsize(fdt))
|
|| (absoffset + len) > fdt_totalsize(fdt))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (fdt_version(fdt) >= 0x11)
|
if (fdt_version(fdt) >= 0x11)
|
||||||
if (((offset + len) < offset)
|
if (((uoffset + len) < uoffset)
|
||||||
|| ((offset + len) > fdt_size_dt_struct(fdt)))
|
|| ((offset + len) > fdt_size_dt_struct(fdt)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue