lkml.org 
[lkml]   [2022]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] staging: rtl8712: Fix pointer dereferenced before checking
On Mon, May 30, 2022 at 04:05:32PM +0800, Haowen Bai wrote:
> 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;

This is not a dereference.

>
> if (!prframe || !padapter)
> return;

Not a bug.

Also I agree with your other email that "padapter" cannot be NULL so
the NULL check can be safely deleted.

regards,
dan carpenter

\
 
 \ /
  Last update: 2022-05-30 11:31    [W:0.065 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site