linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Phillip Potter <phil@philpotter.co.uk>
To: gregkh@linuxfoundation.org
Cc: Larry.Finger@lwfinger.net, straube.linux@gmail.com,
	linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev
Subject: [PATCH 13/14] staging: r8188eu: remove rtw_hal_c2h_id_filter_ccx function
Date: Mon,  6 Sep 2021 02:01:05 +0100	[thread overview]
Message-ID: <20210906010106.898-14-phil@philpotter.co.uk> (raw)
In-Reply-To: <20210906010106.898-1-phil@philpotter.co.uk>

Remove rtw_hal_c2h_id_filter_ccx from hal/hal_intf.c and its one caller
from core/rtw_cmd.c. This function is a wrapper function which returns
the c2h_id_filter_ccx function pointer of struct hal_ops unconditionally.
As this function pointer is never set, and the function call's return
value is subsequently called inside an if condition, this could lead to
an attempt to deference a NULL pointer, which would crash the driver.

Signed-off-by: Phillip Potter <phil@philpotter.co.uk>
---
 drivers/staging/r8188eu/core/rtw_cmd.c     | 9 ++-------
 drivers/staging/r8188eu/hal/hal_intf.c     | 5 -----
 drivers/staging/r8188eu/include/hal_intf.h | 1 -
 3 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/staging/r8188eu/core/rtw_cmd.c b/drivers/staging/r8188eu/core/rtw_cmd.c
index fee4208dacba..738e1ec749be 100644
--- a/drivers/staging/r8188eu/core/rtw_cmd.c
+++ b/drivers/staging/r8188eu/core/rtw_cmd.c
@@ -1865,7 +1865,6 @@ static void c2h_wk_callback(struct work_struct *work)
 	struct evt_priv *evtpriv = container_of(work, struct evt_priv, c2h_wk);
 	struct adapter *adapter = container_of(evtpriv, struct adapter, evtpriv);
 	struct c2h_evt_hdr *c2h_evt;
-	c2h_id_filter ccx_id_filter = rtw_hal_c2h_id_filter_ccx(adapter);
 
 	evtpriv->c2h_wk_alive = true;
 
@@ -1895,14 +1894,10 @@ static void c2h_wk_callback(struct work_struct *work)
 			continue;
 		}
 
-		if (ccx_id_filter(c2h_evt->id)) {
-			kfree(c2h_evt);
-		} else {
 #ifdef CONFIG_88EU_P2P
-			/* Enqueue into cmd_thread for others */
-			rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt);
+		/* Enqueue into cmd_thread for others */
+		rtw_c2h_wk_cmd(adapter, (u8 *)c2h_evt);
 #endif
-		}
 	}
 
 	evtpriv->c2h_wk_alive = false;
diff --git a/drivers/staging/r8188eu/hal/hal_intf.c b/drivers/staging/r8188eu/hal/hal_intf.c
index b4fea82bce87..ac4bbaecf8b0 100644
--- a/drivers/staging/r8188eu/hal/hal_intf.c
+++ b/drivers/staging/r8188eu/hal/hal_intf.c
@@ -386,8 +386,3 @@ void rtw_hal_notch_filter(struct adapter *adapter, bool enable)
 	if (adapter->HalFunc.hal_notch_filter)
 		adapter->HalFunc.hal_notch_filter(adapter, enable);
 }
-
-c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter)
-{
-	return adapter->HalFunc.c2h_id_filter_ccx;
-}
diff --git a/drivers/staging/r8188eu/include/hal_intf.h b/drivers/staging/r8188eu/include/hal_intf.h
index 002bcb338cab..6deecbbc284d 100644
--- a/drivers/staging/r8188eu/include/hal_intf.h
+++ b/drivers/staging/r8188eu/include/hal_intf.h
@@ -345,7 +345,6 @@ int rtw_hal_iol_cmd(struct adapter  *adapter, struct xmit_frame *xmit_frame,
 
 void rtw_hal_notch_filter(struct adapter *adapter, bool enable);
 
-c2h_id_filter rtw_hal_c2h_id_filter_ccx(struct adapter *adapter);
 void indicate_wx_scan_complete_event(struct adapter *padapter);
 u8 rtw_do_join(struct adapter *padapter);
 
-- 
2.31.1


  parent reply	other threads:[~2021-09-06  1:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-06  1:00 [PATCH 00/14] staging: r8188eu: cleanup unset pointers in Phillip Potter
2021-09-06  1:00 ` [PATCH 01/14] staging: r8188eu: remove rtw_hal_reset_security_engine function Phillip Potter
2021-09-06  1:00 ` [PATCH 02/14] staging: r8188eu: remove hal_reset_security_engine from struct hal_ops Phillip Potter
2021-09-06  8:25   ` Dan Carpenter
2021-09-06 23:05     ` Phillip Potter
2021-09-06  1:00 ` [PATCH 03/14] staging: r8188eu: remove rtw_hal_enable_interrupt function Phillip Potter
2021-09-06  1:00 ` [PATCH 04/14] staging: r8188eu: remove enable_interrupt from struct hal_ops Phillip Potter
2021-09-06  1:00 ` [PATCH 05/14] staging: r8188eu: remove rtw_hal_disable_interrupt function Phillip Potter
2021-09-06  1:00 ` [PATCH 06/14] staging: r8188eu: remove disable_interrupt from struct hal_ops Phillip Potter
2021-09-06  1:00 ` [PATCH 07/14] staging: r8188eu: remove rtw_hal_interrupt_handler function Phillip Potter
2021-09-06  1:01 ` [PATCH 08/14] staging: r8188eu: remove interrupt_handler from struct hal_ops Phillip Potter
2021-09-06  1:01 ` [PATCH 09/14] staging: r8188eu: remove rtw_hal_xmitframe_enqueue function Phillip Potter
2021-09-06  1:01 ` [PATCH 10/14] staging: r8188eu: remove hal_xmitframe_enqueue from struct hal_ops Phillip Potter
2021-09-06  1:01 ` [PATCH 11/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT function Phillip Potter
2021-09-06  1:01 ` [PATCH 12/14] staging: r8188eu: remove Efuse_PgPacketWrite_BT from struct hal_ops Phillip Potter
2021-09-06  1:01 ` Phillip Potter [this message]
2021-09-06  1:01 ` [PATCH 14/14] staging: r8188eu: remove c2h_id_filter_ccx " Phillip Potter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210906010106.898-14-phil@philpotter.co.uk \
    --to=phil@philpotter.co.uk \
    --cc=Larry.Finger@lwfinger.net \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=straube.linux@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).