* [PATCH v3] dm: core: fix no null pointer detection in ofnode_get_addr_size_index()
@ 2021-07-12 7:40 chenguanqiao
2021-07-20 18:32 ` Simon Glass
2021-07-22 2:11 ` Simon Glass
0 siblings, 2 replies; 3+ messages in thread
From: chenguanqiao @ 2021-07-12 7:40 UTC (permalink / raw
To: sjg, u-boot; +Cc: Chen Guanqiao
From: Chen Guanqiao <chenguanqiao@kuaishou.com>
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>
---
v3:
Add this changelog.
v2:
1. Remove redundant return.
2. apply patch to u-boot/next.
drivers/core/ofnode.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c
index eeeccfb446..dda6c76e83 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)
--
2.27.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v3] dm: core: fix no null pointer detection in ofnode_get_addr_size_index()
2021-07-12 7:40 [PATCH v3] dm: core: fix no null pointer detection in ofnode_get_addr_size_index() chenguanqiao
@ 2021-07-20 18:32 ` Simon Glass
2021-07-22 2:11 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-07-20 18:32 UTC (permalink / raw
To: chenguanqiao; +Cc: U-Boot Mailing List
On Mon, 12 Jul 2021 at 01:40, chenguanqiao <chenguanqiao@kuaishou.com> wrote:
>
> From: Chen Guanqiao <chenguanqiao@kuaishou.com>
>
> 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>
> ---
> v3:
> Add this changelog.
>
> v2:
> 1. Remove redundant return.
> 2. apply patch to u-boot/next.
>
> drivers/core/ofnode.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v3] dm: core: fix no null pointer detection in ofnode_get_addr_size_index()
2021-07-12 7:40 [PATCH v3] dm: core: fix no null pointer detection in ofnode_get_addr_size_index() chenguanqiao
2021-07-20 18:32 ` Simon Glass
@ 2021-07-22 2:11 ` Simon Glass
1 sibling, 0 replies; 3+ messages in thread
From: Simon Glass @ 2021-07-22 2:11 UTC (permalink / raw
To: Simon Glass; +Cc: U-Boot Mailing List, Chen Guanqiao
On Mon, 12 Jul 2021 at 01:40, chenguanqiao <chenguanqiao@kuaishou.com> wrote:
>
> From: Chen Guanqiao <chenguanqiao@kuaishou.com>
>
> 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>
> ---
> v3:
> Add this changelog.
>
> v2:
> 1. Remove redundant return.
> 2. apply patch to u-boot/next.
>
> drivers/core/ofnode.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass <sjg@chromium.org>
Applied to u-boot-dm, thanks!
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-07-22 2:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-12 7:40 [PATCH v3] dm: core: fix no null pointer detection in ofnode_get_addr_size_index() chenguanqiao
2021-07-20 18:32 ` Simon Glass
2021-07-22 2:11 ` Simon Glass
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.