Fix ARM Linux Loader on non-FDT platforms.

This commit is contained in:
Vladimir Serbinenko 2013-12-22 00:30:19 +01:00
parent bf082198e2
commit 0d8b81f89a
5 changed files with 162 additions and 34 deletions

View file

@ -265,10 +265,9 @@ static grub_uint32_t *find_prop (void *fdt, unsigned int nodeoffset,
the size allocated for the FDT; if this function is called before the other
functions in this file and returns success, the other functions are
guaranteed not to access memory locations outside the allocated memory. */
int grub_fdt_check_header (void *fdt, unsigned int size)
int grub_fdt_check_header_nosize (void *fdt)
{
if (((grub_addr_t) fdt & 0x7) || (grub_fdt_get_magic (fdt) != FDT_MAGIC)
|| (grub_fdt_get_totalsize (fdt) > size)
|| (grub_fdt_get_version (fdt) < FDT_SUPPORTED_VERSION)
|| (grub_fdt_get_last_comp_version (fdt) > FDT_SUPPORTED_VERSION)
|| (grub_fdt_get_off_dt_struct (fdt) & 0x00000003)
@ -284,6 +283,15 @@ int grub_fdt_check_header (void *fdt, unsigned int size)
return 0;
}
int grub_fdt_check_header (void *fdt, unsigned int size)
{
if (size < sizeof (grub_fdt_header_t)
|| (grub_fdt_get_totalsize (fdt) > size)
|| grub_fdt_check_header_nosize (fdt) == -1)
return -1;
return 0;
}
/* Find a direct sub-node of a given parent node. */
int grub_fdt_find_subnode (const void *fdt, unsigned int parentoffset,
const char *name)