Skip to contentSkip to conversation

staging: r8188eu: clean up private ioctls

PATCH In review Martin Kaiser 3 participants 13 messages Dec 26, 2021 – Jan 6, 2022 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: r8188eu: clean up private ioctls

Clean up the definitions of private ioctls.
(Maybe it would make more sense to remove them completely?)

Martin Kaiser (10):
staging: r8188eu: remove unused rtw_private_args entries
staging: r8188eu: remove the private ioctl "get sensitivity"
staging: r8188eu: remove the private drvext_hdl ioctl
staging: r8188eu: remove the private ioctl "wps_prob_req_ie"
staging: r8188eu: remove private ioctls that return -1
staging: r8188eu: remove the private ioctl "wps_assoc_req_ie"
staging: r8188eu: remove the private ioctl "tdls_get"
staging: r8188eu: remove the private ioctl "tdls"
staging: r8188eu: remove the private "test" ioctl
staging: r8188eu: remove unused prototype

 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 141 +------------------
 1 file changed, 7 insertions(+), 134 deletions(-)
Signature · 1 line
2.30.2
#1 lore raw

PATCH 1/10 staging: r8188eu: remove unused rtw_private_args entries

Remove the entries of the rtw_private_args array that refer to non-existing private ioctls.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 7 -------
 1 file changed, 7 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +0 -7
index 88e9734b3094..ea8858213771 100644
@@ -4311,9 +4311,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 	{
 		SIOCIWFIRSTPRIV + 0x2, 0, 0, "driver_ext"
 	},
-	{
-		SIOCIWFIRSTPRIV + 0x3, 0, 0, "mp_ioctl"
-	},
 	{
 		SIOCIWFIRSTPRIV + 0x4,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "apinfo"
@@ -4368,7 +4365,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 		SIOCIWFIRSTPRIV + 0x12,
 		IW_PRIV_TYPE_CHAR | P2P_PRIVATE_IOCTL_SET_LEN, IW_PRIV_TYPE_CHAR | IFNAMSIZ, "p2p_get2"
 	},
-	{SIOCIWFIRSTPRIV + 0x13, IW_PRIV_TYPE_CHAR | 128, 0, "NULL"},
 	{
 		SIOCIWFIRSTPRIV + 0x14,
 		IW_PRIV_TYPE_CHAR  | 64, 0, "tdls"
@@ -4386,9 +4382,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 
 	{SIOCIWFIRSTPRIV + 0x1D, IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test"
 	},
-
-	{SIOCIWFIRSTPRIV + 0x0E, IW_PRIV_TYPE_CHAR | 1024, 0, ""},  /* set */
-	{SIOCIWFIRSTPRIV + 0x0F, IW_PRIV_TYPE_CHAR | 1024, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_MASK, ""},/* get */
 };
 
 static iw_handler rtw_private_handler[] = {
Signature · 1 line
2.30.2
#2 lore raw

PATCH 2/10 staging: r8188eu: remove the private ioctl "get sensitivity"

In reply to Martin Kaiser

Remove the private ioctl "get sensitivity", it is mapped to an empty function.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -12
index ea8858213771..bc23754c7f5c 100644
@@ -2119,13 +2119,6 @@ static int rtw_wx_set_mtk_wps_probe_ie(struct net_device *dev,
 	return 0;
 }
 
-static int rtw_wx_get_sensitivity(struct net_device *dev,
-				struct iw_request_info *info,
-				union iwreq_data *wrqu, char *buf)
-{
-	return 0;
-}
-
 static int rtw_wx_set_mtk_wps_ie(struct net_device *dev,
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
@@ -4323,10 +4316,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 		SIOCIWFIRSTPRIV + 0x6,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_start"
 	},
-	{
-		SIOCIWFIRSTPRIV + 0x7,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "get_sensitivity"
-	},
 	{
 		SIOCIWFIRSTPRIV + 0x8,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_prob_req_ie"
@@ -4395,7 +4384,7 @@ NULL,					/* 0x03 */
 	rtw_set_pid,			/* 0x05 */
 	rtw_wps_start,			/* 0x06 */
 
-	rtw_wx_get_sensitivity,		/* 0x07 */
+	NULL,				/* 0x07 */
 	rtw_wx_set_mtk_wps_probe_ie,	/* 0x08 */
 	rtw_wx_set_mtk_wps_ie,		/* 0x09 */
 
Signature · 1 line
2.30.2
#3 lore raw

PATCH 3/10 staging: r8188eu: remove the private drvext_hdl ioctl

In reply to Martin Kaiser

Remove the private drvext_hdl ioctl, it is mapped to an empty function.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -11
index bc23754c7f5c..761511bbb0ad 100644
@@ -2126,16 +2126,6 @@ static int rtw_wx_set_mtk_wps_ie(struct net_device *dev,
 	return 0;
 }
 
-/*
- *	For all data larger than 16 octets, we need to use a
- *	pointer to memory allocated in user space.
- */
-static  int rtw_drvext_hdl(struct net_device *dev, struct iw_request_info *info,
-						union iwreq_data *wrqu, char *extra)
-{
-	return 0;
-}
-
 static int rtw_get_ap_info(struct net_device *dev,
 			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
@@ -4376,7 +4366,7 @@ static const struct iw_priv_args rtw_private_args[] = {
 static iw_handler rtw_private_handler[] = {
 rtw_wx_write32,				/* 0x00 */
 rtw_wx_read32,				/* 0x01 */
-rtw_drvext_hdl,				/* 0x02 */
+	NULL,				/* 0x02 */
 NULL,					/* 0x03 */
 /*  for MM DTV platform */
 	rtw_get_ap_info,		/* 0x04 */
Signature · 1 line
2.30.2
#4 lore raw

PATCH 4/10 staging: r8188eu: remove the private ioctl "wps_prob_req_ie"

In reply to Martin Kaiser

Remove the private ioctl "wps_prob_req_ie", it is mapped to an empty function.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -12
index 761511bbb0ad..b1f4f5ae71c1 100644
@@ -2112,13 +2112,6 @@ static int rtw_wx_set_channel_plan(struct net_device *dev,
 	return 0;
 }
 
-static int rtw_wx_set_mtk_wps_probe_ie(struct net_device *dev,
-		struct iw_request_info *a,
-		union iwreq_data *wrqu, char *b)
-{
-	return 0;
-}
-
 static int rtw_wx_set_mtk_wps_ie(struct net_device *dev,
 				struct iw_request_info *info,
 				union iwreq_data *wrqu, char *extra)
@@ -4306,10 +4299,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 		SIOCIWFIRSTPRIV + 0x6,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_start"
 	},
-	{
-		SIOCIWFIRSTPRIV + 0x8,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_prob_req_ie"
-	},
 	{
 		SIOCIWFIRSTPRIV + 0x9,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_assoc_req_ie"
@@ -4375,7 +4364,7 @@ NULL,					/* 0x03 */
 	rtw_wps_start,			/* 0x06 */
 
 	NULL,				/* 0x07 */
-	rtw_wx_set_mtk_wps_probe_ie,	/* 0x08 */
+	NULL,				/* 0x08 */
 	rtw_wx_set_mtk_wps_ie,		/* 0x09 */
 
 /*  Set Channel depend on the country code */
Signature · 1 line
2.30.2
#5 lore raw

PATCH 5/10 staging: r8188eu: remove private ioctls that return -1

In reply to Martin Kaiser

Remove the private ioctls that are mapped to rtw_wx_priv_null. rtw_wx_priv_null itself can also be removed.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +2 -8
index b1f4f5ae71c1..db88a78b1c87 100644
@@ -2090,12 +2090,6 @@ static int rtw_wx_write_rf(struct net_device *dev,
 	return 0;
 }
 
-static int rtw_wx_priv_null(struct net_device *dev, struct iw_request_info *a,
-		 union iwreq_data *wrqu, char *b)
-{
-	return -1;
-}
-
 static int rtw_wx_set_channel_plan(struct net_device *dev,
 			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
@@ -4385,9 +4379,9 @@ NULL,					/* 0x03 */
 	rtw_tdls_get,			/* 0x15 */
 
 	rtw_pm_set,			/* 0x16 */
-	rtw_wx_priv_null,		/* 0x17 */
+	NULL,				/* 0x17 */
 	rtw_rereg_nd_name,		/* 0x18 */
-	rtw_wx_priv_null,		/* 0x19 */
+	NULL,				/* 0x19 */
 
 	NULL,				/* 0x1A */
 	NULL,				/* 0x1B */
Signature · 1 line
2.30.2
#6 lore raw

PATCH 6/10 staging: r8188eu: remove the private ioctl "wps_assoc_req_ie"

In reply to Martin Kaiser

Remove the private ioctl "wps_assoc_req_ie", it is mapped to an empty function.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -13
index db88a78b1c87..776b4f5cb77d 100644
@@ -2106,13 +2106,6 @@ static int rtw_wx_set_channel_plan(struct net_device *dev,
 	return 0;
 }
 
-static int rtw_wx_set_mtk_wps_ie(struct net_device *dev,
-				struct iw_request_info *info,
-				union iwreq_data *wrqu, char *extra)
-{
-	return 0;
-}
-
 static int rtw_get_ap_info(struct net_device *dev,
 			       struct iw_request_info *info,
 			       union iwreq_data *wrqu, char *extra)
@@ -4293,11 +4286,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 		SIOCIWFIRSTPRIV + 0x6,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_start"
 	},
-	{
-		SIOCIWFIRSTPRIV + 0x9,
-		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "wps_assoc_req_ie"
-	},
-
 	{
 		SIOCIWFIRSTPRIV + 0xA,
 		IW_PRIV_TYPE_INT | IW_PRIV_SIZE_FIXED | 1, 0, "channel_plan"
@@ -4359,7 +4347,7 @@ NULL,					/* 0x03 */
 
 	NULL,				/* 0x07 */
 	NULL,				/* 0x08 */
-	rtw_wx_set_mtk_wps_ie,		/* 0x09 */
+	NULL,				/* 0x09 */
 
 /*  Set Channel depend on the country code */
 	rtw_wx_set_channel_plan,	/* 0x0A */
Signature · 1 line
2.30.2
#7 lore raw

PATCH 7/10 staging: r8188eu: remove the private ioctl "tdls_get"

In reply to Martin Kaiser

Remove the private ioctl "tdls_get", it is mapped to an empty function.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -12
index 776b4f5cb77d..47c1662394f3 100644
@@ -4185,13 +4185,6 @@ static int rtw_tdls(struct net_device *dev,
 	return 0;
 }
 
-static int rtw_tdls_get(struct net_device *dev,
-				struct iw_request_info *info,
-				union iwreq_data *wrqu, char *extra)
-{
-	return 0;
-}
-
 static int rtw_test(
 	struct net_device *dev,
 	struct iw_request_info *info,
@@ -4319,10 +4312,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 		SIOCIWFIRSTPRIV + 0x14,
 		IW_PRIV_TYPE_CHAR  | 64, 0, "tdls"
 	},
-	{
-		SIOCIWFIRSTPRIV + 0x15,
-		IW_PRIV_TYPE_CHAR | P2P_PRIVATE_IOCTL_SET_LEN, IW_PRIV_TYPE_CHAR | IW_PRIV_SIZE_FIXED | P2P_PRIVATE_IOCTL_SET_LEN, "tdls_get"
-	},
 	{
 		SIOCIWFIRSTPRIV + 0x16,
 		IW_PRIV_TYPE_CHAR | 64, 0, "pm_set"
@@ -4364,7 +4353,7 @@ NULL,					/* 0x03 */
 
 	NULL,				/* 0x13 */
 	rtw_tdls,			/* 0x14 */
-	rtw_tdls_get,			/* 0x15 */
+	NULL,				/* 0x15 */
 
 	rtw_pm_set,			/* 0x16 */
 	NULL,				/* 0x17 */
Signature · 1 line
2.30.2
#8 lore raw

PATCH 8/10 staging: r8188eu: remove the private ioctl "tdls"

In reply to Martin Kaiser

Remove the private ioctl "tdls", it is mapped to an empty function.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +1 -12
index 47c1662394f3..911f10627551 100644
@@ -4178,13 +4178,6 @@ static int rtw_pm_set(struct net_device *dev,
 
 extern int wifirate2_ratetbl_inx(unsigned char rate);
 
-static int rtw_tdls(struct net_device *dev,
-		    struct iw_request_info *info,
-		    union iwreq_data *wrqu, char *extra)
-{
-	return 0;
-}
-
 static int rtw_test(
 	struct net_device *dev,
 	struct iw_request_info *info,
@@ -4308,10 +4301,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 		SIOCIWFIRSTPRIV + 0x12,
 		IW_PRIV_TYPE_CHAR | P2P_PRIVATE_IOCTL_SET_LEN, IW_PRIV_TYPE_CHAR | IFNAMSIZ, "p2p_get2"
 	},
-	{
-		SIOCIWFIRSTPRIV + 0x14,
-		IW_PRIV_TYPE_CHAR  | 64, 0, "tdls"
-	},
 	{
 		SIOCIWFIRSTPRIV + 0x16,
 		IW_PRIV_TYPE_CHAR | 64, 0, "pm_set"
@@ -4352,7 +4341,7 @@ NULL,					/* 0x03 */
 	rtw_p2p_get2,			/* 0x12 */
 
 	NULL,				/* 0x13 */
-	rtw_tdls,			/* 0x14 */
+	NULL,				/* 0x14 */
 	NULL,				/* 0x15 */
 
 	rtw_pm_set,			/* 0x16 */
Signature · 1 line
2.30.2
#9 lore raw

PATCH 9/10 staging: r8188eu: remove the private "test" ioctl

In reply to Martin Kaiser

Remove the private "test" ioctl. It copies data from user space, this data is not used.

We can now remove a number of NULL entries at the end of the private ioctl list.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 46 --------------------
 1 file changed, 46 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +0 -46
index 911f10627551..c08b60ec1e64 100644
@@ -4178,43 +4178,6 @@ static int rtw_pm_set(struct net_device *dev,
 
 extern int wifirate2_ratetbl_inx(unsigned char rate);
 
-static int rtw_test(
-	struct net_device *dev,
-	struct iw_request_info *info,
-	union iwreq_data *wrqu, char *extra)
-{
-	u32 len;
-	u8 *pbuf, *pch;
-	char *ptmp;
-	u8 *delim = ",";
-
-	DBG_88E("+%s\n", __func__);
-	len = wrqu->data.length;
-
-	pbuf = kzalloc(len, GFP_KERNEL);
-	if (!pbuf) {
-		DBG_88E("%s: no memory!\n", __func__);
-		return -ENOMEM;
-	}
-
-	if (copy_from_user(pbuf, wrqu->data.pointer, len)) {
-		kfree(pbuf);
-		DBG_88E("%s: copy from user fail!\n", __func__);
-		return -EFAULT;
-	}
-	DBG_88E("%s: string =\"%s\"\n", __func__, pbuf);
-
-	ptmp = (char *)pbuf;
-	pch = strsep(&ptmp, delim);
-	if (!pch || strlen(pch) == 0) {
-		kfree(pbuf);
-		DBG_88E("%s: parameter error(level 1)!\n", __func__);
-		return -EFAULT;
-	}
-	kfree(pbuf);
-	return 0;
-}
-
 static iw_handler rtw_handlers[] = {
 	IW_HANDLER(SIOCGIWNAME, rtw_wx_get_name),
 	IW_HANDLER(SIOCGIWFREQ, rtw_wx_get_freq),
@@ -4307,9 +4270,6 @@ static const struct iw_priv_args rtw_private_args[] = {
 	},
 
 	{SIOCIWFIRSTPRIV + 0x18, IW_PRIV_TYPE_CHAR | IFNAMSIZ, 0, "rereg_nd_name"},
-
-	{SIOCIWFIRSTPRIV + 0x1D, IW_PRIV_TYPE_CHAR | 40, IW_PRIV_TYPE_CHAR | 0x7FF, "test"
-	},
 };
 
 static iw_handler rtw_private_handler[] = {
@@ -4347,12 +4307,6 @@ NULL,					/* 0x03 */
 	rtw_pm_set,			/* 0x16 */
 	NULL,				/* 0x17 */
 	rtw_rereg_nd_name,		/* 0x18 */
-	NULL,				/* 0x19 */
-
-	NULL,				/* 0x1A */
-	NULL,				/* 0x1B */
-	NULL,				/*  0x1C is reserved for hostapd */
-	rtw_test,			/*  0x1D */
 };
 
 static struct iw_statistics *rtw_get_wireless_stats(struct net_device *dev)
Signature · 1 line
2.30.2
#10 lore raw

Re: [PATCH 09/10] staging: r8188eu: remove the private "test" ioctl

Quoted 2 lines · Martin Kaiser

Remove the private "test" ioctl. It copies data from user space, this data is not used.

It also had some memory corruption bugs because of the lack of NUL termination.

regards,
dan carpenter

#11 lore raw

PATCH 10/10 staging: r8188eu: remove unused prototype

In reply to Martin Kaiser

Remove the prototype for wifirate2_ratetbl_inx, it is not needed.

---
 drivers/staging/r8188eu/os_dep/ioctl_linux.c | 2 --
 1 file changed, 2 deletions(-)
drivers/staging/r8188eu/os_dep/ioctl_linux.c +0 -2
index c08b60ec1e64..adc03862bc03 100644
@@ -4176,8 +4176,6 @@ static int rtw_pm_set(struct net_device *dev,
 	return ret;
 }
 
-extern int wifirate2_ratetbl_inx(unsigned char rate);
-
 static iw_handler rtw_handlers[] = {
 	IW_HANDLER(SIOCGIWNAME, rtw_wx_get_name),
 	IW_HANDLER(SIOCGIWFREQ, rtw_wx_get_freq),
Signature · 1 line
2.30.2
#12 lore raw
In reply to Martin Kaiser
Quoted 2 lines · Martin Kaiser

Clean up the definitions of private ioctls.
(Maybe it would make more sense to remove them completely?)

If none of them are really "standard", then yes, they should be removed.

At the very least, the correct macros should be used for the remaining ones.

I'll go queue this up now, thanks!

greg k-h