public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] staging: rtl8712: Fix pointer dereferenced before checking
@ 2022-05-30  8:05 Haowen Bai
  2022-05-30  8:14 ` Greg Kroah-Hartman
  2022-05-30  9:29 ` Dan Carpenter
  0 siblings, 2 replies; 6+ messages in thread
From: Haowen Bai @ 2022-05-30  8:05 UTC (permalink / raw)
  To: Larry Finger, Florian Schilhabel, Greg Kroah-Hartman
  Cc: Haowen Bai, linux-staging, linux-kernel

The padapter->recvpriv.signal_qual_data is dereferencing before null
checking, so move it after checking.

Signed-off-by: Haowen Bai <baihaowen@meizu.com>
---
 drivers/staging/rtl8712/rtl8712_recv.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/rtl8712/rtl8712_recv.c b/drivers/staging/rtl8712/rtl8712_recv.c
index 7f1fdd058551..8ed94b259dbe 100644
--- a/drivers/staging/rtl8712/rtl8712_recv.c
+++ b/drivers/staging/rtl8712/rtl8712_recv.c
@@ -863,10 +863,12 @@ static void process_link_qual(struct _adapter *padapter,
 {
 	u32	last_evm = 0, tmpVal;
 	struct rx_pkt_attrib *pattrib;
-	struct smooth_rssi_data *sqd = &padapter->recvpriv.signal_qual_data;
+	struct smooth_rssi_data *sqd;
 
 	if (!prframe || !padapter)
 		return;
+
+	sqd = &padapter->recvpriv.signal_qual_data;
 	pattrib = &prframe->u.hdr.attrib;
 	if (pattrib->signal_qual != 0) {
 		/*
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-05-30  9:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-30  8:05 [PATCH] staging: rtl8712: Fix pointer dereferenced before checking Haowen Bai
2022-05-30  8:14 ` Greg Kroah-Hartman
2022-05-30  8:22   ` baihaowen
2022-05-30  8:26     ` Greg Kroah-Hartman
2022-05-30  8:44       ` baihaowen
2022-05-30  9:29 ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox