[PATCH] staging: ks7010: Remove unneeded check in ks_wlan_get_range()

Aleksandr Mishin posted 1 patch 1 year, 7 months ago
drivers/staging/ks7010/ks_wlan_net.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
[PATCH] staging: ks7010: Remove unneeded check in ks_wlan_get_range()
Posted by Aleksandr Mishin 1 year, 7 months ago
In ks_wlan_get_range() variable 'i' which value is always 12, is compared
to 2. This check is unneeded and should be removed.

Remove unneeded check to clean up the code.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")
Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
---
 drivers/staging/ks7010/ks_wlan_net.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
index 0fb97a79ad0b..d56dae73e7ed 100644
--- a/drivers/staging/ks7010/ks_wlan_net.c
+++ b/drivers/staging/ks7010/ks_wlan_net.c
@@ -972,10 +972,7 @@ static int ks_wlan_get_range(struct net_device *dev,
 	 * in bit/s that we can expect using this interface.
 	 * May be use for QoS stuff... Jean II
 	 */
-	if (i > 2)
-		range->throughput = 5000 * 1000;
-	else
-		range->throughput = 1500 * 1000;
+	range->throughput = 5000 * 1000;
 
 	range->min_rts = 0;
 	range->max_rts = 2347;
-- 
2.30.2
Re: [PATCH] staging: ks7010: Remove unneeded check in ks_wlan_get_range()
Posted by Wolfram Sang 1 year, 7 months ago
On Fri, Jul 05, 2024 at 11:44:34PM +0300, Aleksandr Mishin wrote:
> In ks_wlan_get_range() variable 'i' which value is always 12, is compared
> to 2. This check is unneeded and should be removed.
> 
> Remove unneeded check to clean up the code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>

I thought this driver was to be removed[1]? Phillip (CCed), what is the
current status? If you are busy, I can remove it as well...

[1] https://lore.kernel.org/all/igi27iwrzg3ovgj3sym4gsi45timpkt4vkl5ss5dbftdzat6p4@ctxcjocvunpt/

Re: [PATCH] staging: ks7010: Remove unneeded check in ks_wlan_get_range()
Posted by Philipp Hortmann 1 year, 7 months ago
On 7/6/24 16:16, Wolfram Sang wrote:
> On Fri, Jul 05, 2024 at 11:44:34PM +0300, Aleksandr Mishin wrote:
>> In ks_wlan_get_range() variable 'i' which value is always 12, is compared
>> to 2. This check is unneeded and should be removed.
>>
>> Remove unneeded check to clean up the code.
>>
>> Found by Linux Verification Center (linuxtesting.org) with SVACE.
>>
>> Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")
>> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> 
> I thought this driver was to be removed[1]? Phillip (CCed), what is the
> current status? If you are busy, I can remove it as well...
> 
> [1] https://lore.kernel.org/all/igi27iwrzg3ovgj3sym4gsi45timpkt4vkl5ss5dbftdzat6p4@ctxcjocvunpt/
> 


Hi Wolfram,

no the driver is not removed yet. Planned to do this on the next cycle. 
I did remove two others and wanted to wait some time to see if any 
complains arise. I am a bit scared.

Please always consider: If you do not use the driver, it does not mean 
that anybody else is also not using it.

But may be you are right. I am a bit slow and to hesitant.

I plan to send deletion in 3 weeks.

Bye Philipp
Re: [PATCH] staging: ks7010: Remove unneeded check in ks_wlan_get_range()
Posted by Wolfram Sang 1 year, 7 months ago
Hi Philipp,

> no the driver is not removed yet. Planned to do this on the next cycle. I

Ah, this is good to know!

> did remove two others and wanted to wait some time to see if any complains
> arise. I am a bit scared.

No worries, it is okay to be rather a tad too cautios than too careless
IMO.

> Please always consider: If you do not use the driver, it does not mean that
> anybody else is also not using it.

I am very well aware of that. However, hardware is super-rare (it was
even some years ago) and it doesn't support network encryptions we
really want users to use. Risk is low. And even in the unlikely case of
someone complaining, we can revert, right?

> But may be you are right. I am a bit slow and to hesitant.

I don't think removing it next cycle is "slow". But it is good, of
course, to let people know of your plans. Like a reply to my mail saying
"OK, let's remove it next cycle" would keep me in the loop. But no harm
done, I can also ask what the status is. Like I did now. All good.

> I plan to send deletion in 3 weeks.

Perfect. You can already add my

Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>

Thank you and happy hacking,

   Wolfram

Re: [PATCH] staging: ks7010: Remove unneeded check in ks_wlan_get_range()
Posted by Dan Carpenter 1 year, 7 months ago
On Fri, Jul 05, 2024 at 11:44:34PM +0300, Aleksandr Mishin wrote:
> In ks_wlan_get_range() variable 'i' which value is always 12, is compared
> to 2. This check is unneeded and should be removed.
> 
> Remove unneeded check to clean up the code.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: 13a9930d15b4 ("staging: ks7010: add driver from Nanonote extra-repository")
> Signed-off-by: Aleksandr Mishin <amishin@t-argos.ru>
> ---
>  drivers/staging/ks7010/ks_wlan_net.c | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/staging/ks7010/ks_wlan_net.c b/drivers/staging/ks7010/ks_wlan_net.c
> index 0fb97a79ad0b..d56dae73e7ed 100644
> --- a/drivers/staging/ks7010/ks_wlan_net.c
> +++ b/drivers/staging/ks7010/ks_wlan_net.c
> @@ -972,10 +972,7 @@ static int ks_wlan_get_range(struct net_device *dev,
>  	 * in bit/s that we can expect using this interface.
>  	 * May be use for QoS stuff... Jean II
>  	 */
> -	if (i > 2)
> -		range->throughput = 5000 * 1000;
> -	else
> -		range->throughput = 1500 * 1000;
> +	range->throughput = 5000 * 1000;
>  

This is part of a custom IOCTL.  According to the comment, we're
providing the 5 million as information to the user which I guess they
might use for QoS stuff...  It's kind of pointless.

Anway, the patch doesn't make anything worse.

Reviewed-by: Dan Carpenter <dan.carpenter@linaro.org>

KTODO: delete custom ioctls in ks7010.  (requires careful audit or testing)

regards,
dan carpenter