diff options
author | Alison Wang <b18965@freescale.com> | 2015-09-01 10:47:27 +0800 |
---|---|---|
committer | York Sun <yorksun@freescale.com> | 2015-10-26 09:09:55 -0700 |
commit | 6a00a9cb1536c5a19269d539642fb1cced0b5a9f (patch) | |
tree | 52331d0d0a2295f30c4656ca34b5a8e5afe4aa2e | |
parent | da77c819903be2c179f67b37f9285ce39ebd3c5d (diff) | |
download | u-boot-imx-6a00a9cb1536c5a19269d539642fb1cced0b5a9f.zip u-boot-imx-6a00a9cb1536c5a19269d539642fb1cced0b5a9f.tar.gz u-boot-imx-6a00a9cb1536c5a19269d539642fb1cced0b5a9f.tar.bz2 |
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: Alison Wang <alison.wang@freescale.com>
Reviewed-by: York Sun <yorksun@freescale.com>
-rw-r--r-- | arch/arm/cpu/armv8/fsl-lsch3/fdt.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/cpu/armv8/fsl-lsch3/fdt.c b/arch/arm/cpu/armv8/fsl-lsch3/fdt.c index 567c419..922e8a0 100644 --- a/arch/arm/cpu/armv8/fsl-lsch3/fdt.c +++ b/arch/arm/cpu/armv8/fsl-lsch3/fdt.c @@ -33,8 +33,8 @@ void ft_fixup_cpu(void *blob) off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 4); while (off != -FDT_ERR_NOTFOUND) { reg = (fdt32_t *)fdt_getprop(blob, off, "reg", 0); - core_id = of_read_number(reg, addr_cells); if (reg) { + core_id = of_read_number(reg, addr_cells); if (core_id == 0 || (is_core_online(core_id))) { val = spin_tbl_addr; val += id_to_core(core_id) * |