* [PATCH V2] rtlwifi: Return correct failure code on error
@ 2012-02-08 21:14 Simon Graham
2012-02-09 1:59 ` Larry Finger
0 siblings, 1 reply; 3+ messages in thread
From: Simon Graham @ 2012-02-08 21:14 UTC (permalink / raw)
To: linux-wireless; +Cc: linville, Larry.Finger, chaoming_li
Callers of rtl_pci_init expect zero to be returned on error. Returning
the error code leads to the data being used when it shouldn't causing,
amongst other things, divide by zero panics attempting to use the
ring size that is set to zero.
Signed-off-by: Simon Graham <simon.graham@virtualcomputer.com>
---
drivers/net/wireless/rtlwifi/pci.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
index fb84707..f0ce366 100644
--- a/drivers/net/wireless/rtlwifi/pci.c
+++ b/drivers/net/wireless/rtlwifi/pci.c
@@ -1492,7 +1492,7 @@ static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
if (err) {
RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
"tx ring initialization failed\n");
- return err;
+ return 0;
}
return 1;
--
1.7.8.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH V2] rtlwifi: Return correct failure code on error
2012-02-08 21:14 [PATCH V2] rtlwifi: Return correct failure code on error Simon Graham
@ 2012-02-09 1:59 ` Larry Finger
2012-02-09 2:18 ` Simon Graham
0 siblings, 1 reply; 3+ messages in thread
From: Larry Finger @ 2012-02-09 1:59 UTC (permalink / raw)
To: Simon Graham; +Cc: linux-wireless, linville, chaoming_li
On 02/08/2012 03:14 PM, Simon Graham wrote:
> Callers of rtl_pci_init expect zero to be returned on error. Returning
> the error code leads to the data being used when it shouldn't causing,
> amongst other things, divide by zero panics attempting to use the
> ring size that is set to zero.
>
> Signed-off-by: Simon Graham<simon.graham@virtualcomputer.com>
> ---
> drivers/net/wireless/rtlwifi/pci.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/net/wireless/rtlwifi/pci.c b/drivers/net/wireless/rtlwifi/pci.c
> index fb84707..f0ce366 100644
> --- a/drivers/net/wireless/rtlwifi/pci.c
> +++ b/drivers/net/wireless/rtlwifi/pci.c
> @@ -1492,7 +1492,7 @@ static int rtl_pci_init(struct ieee80211_hw *hw, struct pci_dev *pdev)
> if (err) {
> RT_TRACE(rtlpriv, COMP_ERR, DBG_EMERG,
> "tx ring initialization failed\n");
> - return err;
> + return 0;
> }
>
> return 1;
You must have an extreme memory limitation to find all these problems.
As long as you are reworking this section, I would prefer you leave the "return
err" as it is now, change the "return 1" to "return 0", and remove the not
operator in "err = !rtl_pci_init(hw, pdev);" call of this routine. I just
discovered it a few days ago, and it bothers me, but I've been too busy to
submit a fix. In addition, these changes will convert rtl_pci_init() into a more
normal routine that returns 0 if OK and non-zero on errors.
Larry
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH V2] rtlwifi: Return correct failure code on error
2012-02-09 1:59 ` Larry Finger
@ 2012-02-09 2:18 ` Simon Graham
0 siblings, 0 replies; 3+ messages in thread
From: Simon Graham @ 2012-02-09 2:18 UTC (permalink / raw)
To: Larry Finger; +Cc: linux-wireless, linville, chaoming_li
> > return 1;
>
> You must have an extreme memory limitation to find all these problems.
>
As part of system testing we do
> As long as you are reworking this section, I would prefer you leave
the
> "return
> err" as it is now, change the "return 1" to "return 0", and remove the
> not
> operator in "err = !rtl_pci_init(hw, pdev);" call of this routine. I
> just
> discovered it a few days ago, and it bothers me, but I've been too
busy
> to
> submit a fix. In addition, these changes will convert rtl_pci_init()
> into a more
> normal routine that returns 0 if OK and non-zero on errors.
>
OK - I'll do that tomorrow and resubmit (hopefully correctly this time!)
> Larry
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2012-02-09 2:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-02-08 21:14 [PATCH V2] rtlwifi: Return correct failure code on error Simon Graham
2012-02-09 1:59 ` Larry Finger
2012-02-09 2:18 ` Simon Graham
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).