2011-11-07 17:49:56

by Felix Fietkau

[permalink] [raw]
Subject: [PATCH] iw: fix regression in tx power validation

Only bail out if the last character is *not* \0
---
phy.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/phy.c b/phy.c
index 91042b4..d9090fd 100644
--- a/phy.c
+++ b/phy.c
@@ -293,7 +293,7 @@ static int handle_txpower(struct nl80211_state *state,
}

mbm = strtol(argv[1], &endptr, 10);
- if (!*endptr)
+ if (*endptr)
return 2;
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, mbm);
} else if (argc != 1)
--
1.7.3.2



2011-11-07 17:58:54

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] iw: fix regression in tx power validation

On Mon, 2011-11-07 at 18:49 +0100, Felix Fietkau wrote:
> Only bail out if the last character is *not* \0

Oops, thanks.

> ---
> phy.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/phy.c b/phy.c
> index 91042b4..d9090fd 100644
> --- a/phy.c
> +++ b/phy.c
> @@ -293,7 +293,7 @@ static int handle_txpower(struct nl80211_state *state,
> }
>
> mbm = strtol(argv[1], &endptr, 10);
> - if (!*endptr)
> + if (*endptr)
> return 2;
> NLA_PUT_U32(msg, NL80211_ATTR_WIPHY_TX_POWER_LEVEL, mbm);
> } else if (argc != 1)