On 14.11.2024, 04:38, "Stephen Hemminger" wrote:
>
>
>Need to check the result of malloc() before calling memset.
>This is only place in this driver that forgot, other code
>does check.
>
>
>Signed-off-by: Stephen Hemminger <step...@networkplumber.org 
><mailto:step...@networkplumber.org>>
>---
>drivers/net/ntnic/nthw/nthw_rac.c | 4 +++-
>1 file changed, 3 insertions(+), 1 deletion(-)
>
>
>diff --git a/drivers/net/ntnic/nthw/nthw_rac.c 
>b/drivers/net/ntnic/nthw/nthw_rac.c
>index ca6aba6db2..f275e64da3 100644
>--- a/drivers/net/ntnic/nthw/nthw_rac.c
>+++ b/drivers/net/ntnic/nthw/nthw_rac.c
>@@ -31,7 +31,9 @@
>nthw_rac_t *nthw_rac_new(void)
>{
>nthw_rac_t *p = malloc(sizeof(nthw_rac_t));
>- memset(p, 0, sizeof(nthw_rac_t));
>+
>+ if (p)
>+ memset(p, 0, sizeof(nthw_rac_t));
>return p;
>}
>
>
>-- 
>2.45.2
>
>
Hi Stephen,

Thanks a lot for noticing and fixing this issue.
We appreciate it.

Reviewed-by: Serhii Iliushyk <sil-...@napatech.com>


Reply via email to