2022-03-11 15:32:18

by Weiguo Li

[permalink] [raw]
Subject: [PATCH] qtnfmac: fix null check

We did a null check after "mac_info->if_comb = kcalloc(...)", but we checked
"mac->macinfo.if_comb" instead of "mac_info->if_comb".

Signed-off-by: Weiguo Li <[email protected]>
---
drivers/net/wireless/quantenna/qtnfmac/commands.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/quantenna/qtnfmac/commands.c b/drivers/net/wireless/quantenna/qtnfmac/commands.c
index c68563c83098..e4271405b997 100644
--- a/drivers/net/wireless/quantenna/qtnfmac/commands.c
+++ b/drivers/net/wireless/quantenna/qtnfmac/commands.c
@@ -1256,7 +1256,7 @@ qtnf_cmd_resp_proc_mac_info(struct qtnf_wmac *mac,
sizeof(*mac->macinfo.if_comb),
GFP_KERNEL);

- if (!mac->macinfo.if_comb)
+ if (!mac_info->if_comb)
return -ENOMEM;

return 0;
--
2.25.1


2022-03-11 20:08:03

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] qtnfmac: fix null check

On Fri, 2022-03-11 at 21:30 +0800, Weiguo Li wrote:
> We did a null check after "mac_info->if_comb = kcalloc(...)", but we checked
> "mac->macinfo.if_comb" instead of "mac_info->if_comb".

Yeah well:

mac_info = &mac->macinfo;

johannes

2022-03-12 09:17:13

by Weiguo Li

[permalink] [raw]
Subject: Re: [PATCH] qtnfmac: fix null check

On Fri, 11 Mar 2022 19:04:10 +0100, Johannes Berg wrote:
> On Fri, 2022-03-11 at 21:30 +0800, Weiguo Li wrote:
> > We did a null check after "mac_info->if_comb = kcalloc(...)", but we checked
> > "mac->macinfo.if_comb" instead of "mac_info->if_comb".
>
> Yeah well:
>
> mac_info = &mac->macinfo;
>
> johannes

Ha, I didn't notice this... So it's not a problem.

Thanks johannes!

-weiguo