mirror of
https://github.com/dgibson/dtc.git
synced 2025-10-14 00:37:41 -04:00
libfdt: Propagate name errors in fdt_getprop_by_offset()
fdt_getprop_by_offset() doesn't check for errors from fdt_string() - after all, until very recently it couldn't fail. Now it can, so we need to propagate errors up to the caller. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Tested-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Alexey Kardashevskiy <aik@ozlabs.ru> Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
70166d62a2
commit
719d582e98
1 changed files with 12 additions and 2 deletions
|
@ -461,8 +461,18 @@ const void *fdt_getprop_by_offset(const void *fdt, int offset,
|
||||||
prop = fdt_get_property_by_offset_(fdt, offset, lenp);
|
prop = fdt_get_property_by_offset_(fdt, offset, lenp);
|
||||||
if (!prop)
|
if (!prop)
|
||||||
return NULL;
|
return NULL;
|
||||||
if (namep)
|
if (namep) {
|
||||||
*namep = fdt_string(fdt, fdt32_to_cpu(prop->nameoff));
|
const char *name;
|
||||||
|
int namelen;
|
||||||
|
name = fdt_get_string(fdt, fdt32_to_cpu(prop->nameoff),
|
||||||
|
&namelen);
|
||||||
|
if (!name) {
|
||||||
|
if (lenp)
|
||||||
|
*lenp = namelen;
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
*namep = name;
|
||||||
|
}
|
||||||
|
|
||||||
/* Handle realignment */
|
/* Handle realignment */
|
||||||
if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 &&
|
if (fdt_version(fdt) < 0x10 && (offset + sizeof(*prop)) % 8 &&
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue