diff mbox

mac80211: fix failed to set smps

Message ID 1427433674-5745-1-git-send-email-miaoqing@qca.qualcomm.com (mailing list archive)
State Rejected
Delegated to: Johannes Berg
Headers show

Commit Message

miaoqing pan March 27, 2015, 5:21 a.m. UTC
From: Miaoqing Pan <miaoqing@qca.qualcomm.com>

Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
---
 net/mac80211/debugfs_netdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Johannes Berg March 30, 2015, 8:43 a.m. UTC | #1
On Fri, 2015-03-27 at 13:21 +0800, miaoqing@qti.qualcomm.com wrote:
> From: Miaoqing Pan <miaoqing@qca.qualcomm.com>
> 
> Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>

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

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Krishna Chaitanya March 30, 2015, 9:34 a.m. UTC | #2
On Mon, Mar 30, 2015 at 2:13 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Fri, 2015-03-27 at 13:21 +0800, miaoqing@qti.qualcomm.com wrote:
>> From: Miaoqing Pan <miaoqing@qca.qualcomm.com>
>>
>> Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
>
> 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".
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg March 30, 2015, 10:06 a.m. UTC | #3
On Mon, 2015-03-30 at 15:04 +0530, Krishna Chaitanya wrote:
> On Mon, Mar 30, 2015 at 2:13 PM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > On Fri, 2015-03-27 at 13:21 +0800, miaoqing@qti.qualcomm.com wrote:
> >> From: Miaoqing Pan <miaoqing@qca.qualcomm.com>
> >>
> >> Signed-off-by: Miaoqing Pan <miaoqing@qca.qualcomm.com>
> >
> > 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


--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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;