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:
TreeHugger Robot 2022-08-09 18:15:03 +00:00 committed by Android (Google) Code Review
commit 96de87390d

View file

@ -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;