From: Larry Finger <Larry.Finger@lwfinger.net>
To: Simon Graham <simon.graham@virtualcomputer.com>
Cc: linux-wireless@vger.kernel.org, linville@tuxdriver.com,
chaoming_li@realsil.com.cn
Subject: Re: [PATCH V2] rtlwifi: Return correct failure code on error
Date: Wed, 08 Feb 2012 19:59:40 -0600 [thread overview]
Message-ID: <4F33288C.5090905@lwfinger.net> (raw)
In-Reply-To: <20120208211436.GA1309@simgr-precise.oldroadcomputing.net>
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
next prev parent reply other threads:[~2012-02-09 1:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-08 21:14 [PATCH V2] rtlwifi: Return correct failure code on error Simon Graham
2012-02-09 1:59 ` Larry Finger [this message]
2012-02-09 2:18 ` Simon Graham
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=4F33288C.5090905@lwfinger.net \
--to=larry.finger@lwfinger.net \
--cc=chaoming_li@realsil.com.cn \
--cc=linux-wireless@vger.kernel.org \
--cc=linville@tuxdriver.com \
--cc=simon.graham@virtualcomputer.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).