public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] armv8/fsl-lsch3: fdt: Check the pointer returned from call to a function may be NULL
@ 2015-09-01  2:47 Alison Wang
  2015-10-30 16:12 ` York Sun
  0 siblings, 1 reply; 2+ messages in thread
From: Alison Wang @ 2015-09-01  2:47 UTC (permalink / raw)
  To: u-boot

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>
---
 arch/arm/cpu/armv8/fsl-lsch3/fdt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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) *
-- 
2.1.0.27.g96db324

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-10-30 16:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-09-01  2:47 [U-Boot] [PATCH] armv8/fsl-lsch3: fdt: Check the pointer returned from call to a function may be NULL Alison Wang
2015-10-30 16:12 ` York Sun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox