[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1269070744.5740.0.camel@jlt3.sipsolutions.net>
Date: Sat, 20 Mar 2010 00:39:04 -0700
From: Johannes Berg <johannes@...solutions.net>
To: wzt.wzt@...il.com
Cc: linux-kernel@...r.kernel.org, linux-wireless@...r.kernel.org,
flamingice@...rmilk.net
Subject: Re: [PATCH] Wireless: Make cfg80211_dev_rename() check sscanf
return value in net/wireless/core.c
On Sat, 2010-03-20 at 12:53 +0800, wzt.wzt@...il.com wrote:
> Make cfg80211_dev_rename() check sscanf return value.
>
> Signed-off-by: Zhitong Wang <zhitong.wangzt@...baba-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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists