diff mbox series

qtnfmac: fix null check

Message ID tencent_1874B4BE714648459A63EC78424E87226609@qq.com (mailing list archive)
State Changes Requested
Delegated to: Kalle Valo
Headers show
Series qtnfmac: fix null check | expand

Commit Message

Weiguo Li March 11, 2022, 1:30 p.m. UTC
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 <liwg06@foxmail.com>
---
 drivers/net/wireless/quantenna/qtnfmac/commands.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Johannes Berg March 11, 2022, 6:04 p.m. UTC | #1
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
Weiguo Li March 12, 2022, 4:02 a.m. UTC | #2
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
diff mbox series

Patch

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;