2015-03-27 05:21:22

by Pan, Miaoqing

[permalink] [raw]
Subject: [PATCH] mac80211: fix failed to set smps

From: Miaoqing Pan <[email protected]>

Signed-off-by: Miaoqing Pan <[email protected]>
---
net/mac80211/debugfs_netdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/net/mac80211/debugfs_netdev.c b/net/mac80211/debugfs_netdev.c
index 4d7473f..9aeb50d 100644
--- a/net/mac80211/debugfs_netdev.c
+++ b/net/mac80211/debugfs_netdev.c
@@ -276,7 +276,8 @@ static ssize_t ieee80211_if_parse_smps(struct ieee80211_sub_if_data *sdata,
enum ieee80211_smps_mode mode;

for (mode = 0; mode < IEEE80211_SMPS_NUM_MODES; mode++) {
- if (strncmp(buf, smps_modes[mode], buflen) == 0) {
+ if (strncmp(buf, smps_modes[mode],
+ strlen(smps_modes[mode])) == 0) {
int err = ieee80211_set_smps(sdata, mode);
if (!err)
return buflen;
--
1.9.1



2015-03-30 08:43:46

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix failed to set smps

On Fri, 2015-03-27 at 13:21 +0800, [email protected] wrote:
> From: Miaoqing Pan <[email protected]>
>
> Signed-off-by: Miaoqing Pan <[email protected]>

Since you give no commit log, I can only guess what you're trying to do,
but I suppose you need to use "echo -n" instead of "echo".

johannes


2015-03-30 10:06:21

by Johannes Berg

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix failed to set smps

On Mon, 2015-03-30 at 15:04 +0530, Krishna Chaitanya wrote:
> On Mon, Mar 30, 2015 at 2:13 PM, Johannes Berg
> <[email protected]> wrote:
> > On Fri, 2015-03-27 at 13:21 +0800, [email protected] wrote:
> >> From: Miaoqing Pan <[email protected]>
> >>
> >> Signed-off-by: Miaoqing Pan <[email protected]>
> >
> > Since you give no commit log, I can only guess what you're trying to do,
> > but I suppose you need to use "echo -n" instead of "echo".
> Johannes,
>
> We had this discussion earlier also, i still strongly feel all cases
> must work with "echo" by default, as people are not that familiar
> to use "echo -n".

Well I still strongly feel that accepting garbage on the input like this
patch will do is wrong.

johannes



2015-03-30 09:34:47

by Krishna Chaitanya

[permalink] [raw]
Subject: Re: [PATCH] mac80211: fix failed to set smps

On Mon, Mar 30, 2015 at 2:13 PM, Johannes Berg
<[email protected]> wrote:
> On Fri, 2015-03-27 at 13:21 +0800, [email protected] wrote:
>> From: Miaoqing Pan <[email protected]>
>>
>> Signed-off-by: Miaoqing Pan <[email protected]>
>
> Since you give no commit log, I can only guess what you're trying to do,
> but I suppose you need to use "echo -n" instead of "echo".
Johannes,

We had this discussion earlier also, i still strongly feel all cases
must work with "echo" by default, as people are not that familiar
to use "echo -n".