staging: rtl8723bs: Fix possible usage of NULL pointer in core/rtw_debug.c
authorLarry Finger <Larry.Finger@lwfinger.net>
Sat, 8 Apr 2017 16:07:35 +0000 (11:07 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 9 Apr 2017 07:26:28 +0000 (09:26 +0200)
Smatch reports the following:

  CHECK   drivers/staging/rtl8723bs/core/rtw_debug.c
drivers/staging/rtl8723bs/core/rtw_debug.c:454 proc_get_survey_info() error: we previously assumed 'phead' could be null (see line 453)
drivers/staging/rtl8723bs/core/rtw_debug.c:455 proc_get_survey_info() warn: variable dereferenced before check 'phead' (see line 454)

In the code, there are two successive calls to get_head(). The second
is removed.

Signed-off-by: Larry Finger <Larry.Finger@lwfinger.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/rtl8723bs/core/rtw_debug.c

index d34747b293092e0b70f0098b19a79815121aafd2..51cef55d3f761557e8bfdc7bc636a420259faaec 100644 (file)
@@ -451,7 +451,6 @@ int proc_get_survey_info(struct seq_file *m, void *v)
        spin_lock_bh(&(pmlmepriv->scanned_queue.lock));
        phead = get_list_head(queue);
        plist = phead ? get_next(phead) : NULL;
-       plist = get_next(phead);
        if ((!phead) || (!plist)) {
                spin_unlock_bh(&(pmlmepriv->scanned_queue.lock));
                return 0;