linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hostap: do not return positive number on failure path in prism2_open()
@ 2013-08-05  3:02 Alexey Khoroshilov
  2013-08-05  3:18 ` Alexey Khoroshilov
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Khoroshilov @ 2013-08-05  3:02 UTC (permalink / raw)
  To: Jouni Malinen, John W. Linville
  Cc: Alexey Khoroshilov, linux-wireless, netdev, linux-kernel,
	ldv-project, Alexey Khoroshilov

prism2_open() as an .ndo_open handler should not return positive numbers
in case of failure, but it does return 1 in a couple of places.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilorv@ispras.ru>
---
 drivers/net/wireless/hostap/hostap_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 15f0fad..e4f56ad 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -667,7 +667,7 @@ static int prism2_open(struct net_device *dev)
 	if (local->no_pri) {
 		printk(KERN_DEBUG "%s: could not set interface UP - no PRI "
 		       "f/w\n", dev->name);
-		return 1;
+		return -ENODEV;
 	}
 
 	if ((local->func->card_present && !local->func->card_present(local)) ||
@@ -682,7 +682,7 @@ static int prism2_open(struct net_device *dev)
 		printk(KERN_WARNING "%s: could not enable MAC port\n",
 		       dev->name);
 		prism2_close(dev);
-		return 1;
+		return -ENODEV;
 	}
 	if (!local->dev_enabled)
 		prism2_callback(local, PRISM2_CALLBACK_ENABLE);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] hostap: do not return positive number on failure path in prism2_open()
  2013-08-05  3:02 Alexey Khoroshilov
@ 2013-08-05  3:18 ` Alexey Khoroshilov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Khoroshilov @ 2013-08-05  3:18 UTC (permalink / raw)
  To: Jouni Malinen, John W. Linville
  Cc: linux-wireless, netdev, linux-kernel, ldv-project

Please ignore this mail, there is a misprint in signed-off line.
I will resend the patch.

On 08/05/2013 07:02 AM, Alexey Khoroshilov wrote:
> prism2_open() as an .ndo_open handler should not return positive numbers
> in case of failure, but it does return 1 in a couple of places.
>
> Found by Linux Driver Verification project (linuxtesting.org).
>
> Signed-off-by: Alexey Khoroshilov <khoroshilorv@ispras.ru>
> ---
>  drivers/net/wireless/hostap/hostap_main.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
> index 15f0fad..e4f56ad 100644
> --- a/drivers/net/wireless/hostap/hostap_main.c
> +++ b/drivers/net/wireless/hostap/hostap_main.c
> @@ -667,7 +667,7 @@ static int prism2_open(struct net_device *dev)
>  	if (local->no_pri) {
>  		printk(KERN_DEBUG "%s: could not set interface UP - no PRI "
>  		       "f/w\n", dev->name);
> -		return 1;
> +		return -ENODEV;
>  	}
>  
>  	if ((local->func->card_present && !local->func->card_present(local)) ||
> @@ -682,7 +682,7 @@ static int prism2_open(struct net_device *dev)
>  		printk(KERN_WARNING "%s: could not enable MAC port\n",
>  		       dev->name);
>  		prism2_close(dev);
> -		return 1;
> +		return -ENODEV;
>  	}
>  	if (!local->dev_enabled)
>  		prism2_callback(local, PRISM2_CALLBACK_ENABLE);


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH] hostap: do not return positive number on failure path in prism2_open()
@ 2013-08-05  3:18 Alexey Khoroshilov
  2013-08-05  3:33 ` Joe Perches
  0 siblings, 1 reply; 5+ messages in thread
From: Alexey Khoroshilov @ 2013-08-05  3:18 UTC (permalink / raw)
  To: Jouni Malinen, John W. Linville
  Cc: Alexey Khoroshilov, linux-wireless, netdev, linux-kernel,
	ldv-project

prism2_open() as an .ndo_open handler should not return positive numbers
in case of failure, but it does return 1 in a couple of places.

Found by Linux Driver Verification project (linuxtesting.org).

Signed-off-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
---
 drivers/net/wireless/hostap/hostap_main.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index 15f0fad..e4f56ad 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -667,7 +667,7 @@ static int prism2_open(struct net_device *dev)
 	if (local->no_pri) {
 		printk(KERN_DEBUG "%s: could not set interface UP - no PRI "
 		       "f/w\n", dev->name);
-		return 1;
+		return -ENODEV;
 	}
 
 	if ((local->func->card_present && !local->func->card_present(local)) ||
@@ -682,7 +682,7 @@ static int prism2_open(struct net_device *dev)
 		printk(KERN_WARNING "%s: could not enable MAC port\n",
 		       dev->name);
 		prism2_close(dev);
-		return 1;
+		return -ENODEV;
 	}
 	if (!local->dev_enabled)
 		prism2_callback(local, PRISM2_CALLBACK_ENABLE);
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] hostap: do not return positive number on failure path in prism2_open()
  2013-08-05  3:18 [PATCH] hostap: do not return positive number on failure path in prism2_open() Alexey Khoroshilov
@ 2013-08-05  3:33 ` Joe Perches
  2013-08-05  4:01   ` Alexey Khoroshilov
  0 siblings, 1 reply; 5+ messages in thread
From: Joe Perches @ 2013-08-05  3:33 UTC (permalink / raw)
  To: Alexey Khoroshilov
  Cc: Jouni Malinen, John W. Linville, linux-wireless, netdev,
	linux-kernel, ldv-project

On Mon, 2013-08-05 at 07:18 +0400, Alexey Khoroshilov wrote:
> prism2_open() as an .ndo_open handler should not return positive numbers
> in case of failure, but it does return 1 in a couple of places.
> 
> Found by Linux Driver Verification project (linuxtesting.org).

How?

http://linuxtesting.org/project/ldv
http://linuxtesting.org/results/ldv

Shows defects and patches to fix them, but not any script
used to find it.


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] hostap: do not return positive number on failure path in prism2_open()
  2013-08-05  3:33 ` Joe Perches
@ 2013-08-05  4:01   ` Alexey Khoroshilov
  0 siblings, 0 replies; 5+ messages in thread
From: Alexey Khoroshilov @ 2013-08-05  4:01 UTC (permalink / raw)
  To: Joe Perches
  Cc: Jouni Malinen, John W. Linville, linux-wireless, netdev,
	linux-kernel, ldv-project

On 08/05/2013 07:33 AM, Joe Perches wrote:
> On Mon, 2013-08-05 at 07:18 +0400, Alexey Khoroshilov wrote:
>> prism2_open() as an .ndo_open handler should not return positive numbers
>> in case of failure, but it does return 1 in a couple of places.
>>
>> Found by Linux Driver Verification project (linuxtesting.org).
> How?
>
> http://linuxtesting.org/project/ldv
> http://linuxtesting.org/results/ldv
>
> Shows defects and patches to fix them, but not any script
> used to find it.
There is a link to build instructions there:
http://forge.ispras.ru/projects/ldv/wiki/Downloading_and_Building_LDV

Currently it requires some efforts to install all the dependencies, the
simplest way is to use puppet script for Ubuntu 12.04 that you can find
in the repository.

--
Alexey

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-08-05  4:01 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-08-05  3:18 [PATCH] hostap: do not return positive number on failure path in prism2_open() Alexey Khoroshilov
2013-08-05  3:33 ` Joe Perches
2013-08-05  4:01   ` Alexey Khoroshilov
  -- strict thread matches above, loose matches on Subject: below --
2013-08-05  3:02 Alexey Khoroshilov
2013-08-05  3:18 ` Alexey Khoroshilov

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).