Skip to content
Snippets Groups Projects
Commit 6a00a9cb authored by Alison Wang's avatar Alison Wang Committed by York Sun
Browse files

armv8/fsl-lsch3: fdt: Check the pointer returned from call to a function may be NULL


Pointer 'reg' returned from call to function 'fdt_getprop' may be
NULL, will be passed to function and may be dereferenced there by
passing argument 1 to function 'of_read_number'. So check pointer
'reg' first.

Signed-off-by: default avatarAlison Wang <alison.wang@freescale.com>
Reviewed-by: default avatarYork Sun <yorksun@freescale.com>
parent da77c819
No related branches found
No related tags found
No related merge requests found
...@@ -33,8 +33,8 @@ void ft_fixup_cpu(void *blob) ...@@ -33,8 +33,8 @@ void ft_fixup_cpu(void *blob)
off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4); off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4);
while (off != -FDT_ERR_NOTFOUND) { while (off != -FDT_ERR_NOTFOUND) {
reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0); reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0);
core_id = of_read_number(reg, addr_cells);
if (reg) { if (reg) {
core_id = of_read_number(reg, addr_cells);
if (core_id == 0 || (is_core_online(core_id))) { if (core_id == 0 || (is_core_online(core_id))) {
val = spin_tbl_addr; val = spin_tbl_addr;
val += id_to_core(core_id) * val += id_to_core(core_id) *
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment