public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: wzt.wzt@gmail.com
Cc: linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org,
	flamingice@sourmilk.net
Subject: Re: [PATCH] Wireless: Make cfg80211_dev_rename() check sscanf return value in net/wireless/core.c
Date: Sat, 20 Mar 2010 00:39:04 -0700	[thread overview]
Message-ID: <1269070744.5740.0.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <20100320045352.GA2949@localhost.localdomain>

On Sat, 2010-03-20 at 12:53 +0800, wzt.wzt@gmail.com wrote:
> Make cfg80211_dev_rename() check sscanf return value.
> 
> Signed-off-by: Zhitong Wang <zhitong.wangzt@alibaba-inc.com>
> 
> ---
>  net/wireless/core.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/net/wireless/core.c b/net/wireless/core.c
> index 80afacd..8e815b4 100644
> --- a/net/wireless/core.c
> +++ b/net/wireless/core.c
> @@ -146,7 +146,9 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
>  	int idx, taken = -1, result, digits;
>  
>  	/* prohibit calling the thing phy%d when %d is not its number */
> -	sscanf(newname, PHY_NAME "%d%n", &idx, &taken);
> +	if (sscanf(newname, PHY_NAME "%d%n", &idx, &taken) != 2)
> +		return -EINVAL;
> +

Umm, no, your patch breaks it completely. Look at the logic again.

johannes


      reply	other threads:[~2010-03-20  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-20  4:53 [PATCH] Wireless: Make cfg80211_dev_rename() check sscanf return value in net/wireless/core.c wzt.wzt
2010-03-20  7:39 ` Johannes Berg [this message]

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=1269070744.5740.0.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=flamingice@sourmilk.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=wzt.wzt@gmail.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