diff options
author | Chen Guanqiao <chenguanqiao@kuaishou.com> | 2021-07-12 15:40:20 +0800 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2021-07-21 10:27:35 -0600 |
commit | 1b098b3e655451572054ce933a87231ee16f7133 (patch) | |
tree | c82af4506ebb2e5144438b0d5ef10411257caece | |
parent | fd25ca3275946476d5c3fa32e3e7e3087fa5c572 (diff) | |
download | u-boot-1b098b3e655451572054ce933a87231ee16f7133.zip u-boot-1b098b3e655451572054ce933a87231ee16f7133.tar.gz u-boot-1b098b3e655451572054ce933a87231ee16f7133.tar.bz2 |
dm: core: fix no null pointer detection in ofnode_get_addr_size_index()
Fixed a defect of a null pointer being discovered by Coverity Scan:
CID 331544: Null pointer dereferences (REVERSE_INULL)
Null-checking "size" suggests that it may be null, but it has already been
dereferenced on all paths leading to the check.
Signed-off-by: Chen Guanqiao <chenguanqiao@kuaishou.com>
-rw-r--r-- | drivers/core/ofnode.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index eeeccfb..dda6c76 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -329,7 +329,8 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index, { int na, ns; - *size = FDT_SIZE_T_NONE; + if (size) + *size = FDT_SIZE_T_NONE; if (ofnode_is_np(node)) { const __be32 *prop_val; @@ -340,6 +341,7 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index, &flags); if (!prop_val) return FDT_ADDR_T_NONE; + if (size) *size = size64; @@ -359,8 +361,6 @@ static fdt_addr_t __ofnode_get_addr_size_index(ofnode node, int index, index, na, ns, size, translate); } - - return FDT_ADDR_T_NONE; } fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size) |