mirror of
https://git.codelinaro.org/clo/qsdk/oss/boot/u-boot-2016.git
synced 2025-12-10 07:44:53 +01:00
Merge "lib: fdt: use ULONG_MAX for boundary checks"
This commit is contained in:
commit
0a8ac9e20a
1 changed files with 3 additions and 3 deletions
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
#include "libfdt_internal.h"
|
||||
|
||||
#define UINT_MAX (~0U)
|
||||
#define ULONG_MAX (~0UL)
|
||||
|
||||
int fdt_check_header(const void *fdt)
|
||||
{
|
||||
|
|
@ -41,13 +41,13 @@ int fdt_check_header(const void *fdt)
|
|||
}
|
||||
fdt_end = fdt_start + fdt_totalsize(fdt);
|
||||
|
||||
if (((uint64_t)fdt_start + (uint64_t)fdt_off_dt_struct(fdt) + (uint64_t)fdt_size_dt_struct(fdt)) > UINT_MAX)
|
||||
if (((uint64_t)fdt_start + (uint64_t)fdt_off_dt_struct(fdt) + (uint64_t)fdt_size_dt_struct(fdt)) > ULONG_MAX)
|
||||
return FDT_ERR_BADOFFSET;
|
||||
|
||||
if ((fdt_start + fdt_off_dt_struct(fdt) + fdt_size_dt_struct(fdt)) > fdt_end)
|
||||
return FDT_ERR_BADOFFSET;
|
||||
|
||||
if (((uint64_t)fdt_start + (uint64_t)fdt_off_dt_strings(fdt) + (uint64_t)fdt_size_dt_strings(fdt)) > UINT_MAX)
|
||||
if (((uint64_t)fdt_start + (uint64_t)fdt_off_dt_strings(fdt) + (uint64_t)fdt_size_dt_strings(fdt)) > ULONG_MAX)
|
||||
return FDT_ERR_BADOFFSET;
|
||||
|
||||
if ((fdt_start + fdt_off_dt_strings(fdt) + fdt_size_dt_strings(fdt)) > fdt_end)
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue