public inbox for linux-staging@lists.linux.dev
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Haowen Bai <baihaowen@meizu.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-staging@lists.linux.dev, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Staging: rtl8192u: Fix signedness bug in ieee80211_check_auth_response()
Date: Thu, 14 Apr 2022 14:33:22 +0300	[thread overview]
Message-ID: <20220414113322.GJ3293@kadam> (raw)
In-Reply-To: <1649932332-13305-1-git-send-email-baihaowen@meizu.com>

On Thu, Apr 14, 2022 at 06:32:12PM +0800, Haowen Bai wrote:
> function ieee80211_check_auth_response () unsigned errcode receive auth_parse()'s
> errcode -ENOMEM.
> 
> Signed-off-by: Haowen Bai <baihaowen@meizu.com>
> ---
>  drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> index 1a43979939a8..4d060c3ec077 100644
> --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c
> @@ -1461,7 +1461,7 @@ void ieee80211_softmac_check_all_nets(struct ieee80211_device *ieee)
>  	spin_unlock_irqrestore(&ieee->lock, flags);
>  }
>  
> -static inline u16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
> +static inline s16 auth_parse(struct sk_buff *skb, u8 **challenge, int *chlen)
>  {
>  	struct ieee80211_authentication *a;
>  	u8 *t;


The auth_parse() function returns 0xcafe on error or else it returns
-ENOMEM or it returns WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG (13).  It
returns zero on success.  It's a bit silly to return all these random
things.  It should only return normal kernel error codes.

If we want we could make it print its own error message:

	if (a->status) {
		netdev_info(dev, "Authentication response status code 0x%x",
			    le16_to_cpu(a->status))
		return -EINVAL;
	}

	return 0;

Then delete the printk in the caller or modify it to print an %d instead
of the error code in hex.

regards,
dan carpenter

  reply	other threads:[~2022-04-14 11:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-14 10:32 [PATCH] Staging: rtl8192u: Fix signedness bug in ieee80211_check_auth_response() Haowen Bai
2022-04-14 11:33 ` Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-04-22  2:10 [PATCH] staging: " Haowen Bai

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=20220414113322.GJ3293@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=baihaowen@meizu.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    /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