From: "Toke Høiland-Jørgensen" <toke@toke.dk>
To: Shayne Chen <shayne.chen@mediatek.com>,
linux-wireless <linux-wireless@vger.kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Felix Fietkau <nbd@nbd.name>,
Lorenzo Bianconi <lorenzo.bianconi@redhat.com>,
Ryder Lee <ryder.lee@mediatek.com>,
linux-mediatek <linux-mediatek@lists.infradead.org>,
Shayne Chen <shayne.chen@mediatek.com>,
Sujuan Chen <sujuan.chen@mediatek.com>
Subject: Re: [PATCH] mac80211: fix incorrect strlen of .write in debugfs
Date: Fri, 08 Jan 2021 13:27:30 +0100 [thread overview]
Message-ID: <8735zbipfx.fsf@toke.dk> (raw)
In-Reply-To: <20210108105643.10834-1-shayne.chen@mediatek.com>
Shayne Chen <shayne.chen@mediatek.com> writes:
> This fixes strlen mismatch problems happening in some .write callbacks
> of debugfs.
>
> When trying to configure airtime_flags in debugfs, an error appeared:
> # echo 0 > /sys/kernel/debug/ieee80211/phy0/airtime_flags
> ash: write error: Invalid argument
>
> The error is returned from kstrtou16() since a wrong length makes it
> miss the real end of input string. To fix this, use count as the string
> length, and set proper end of string for a char buffer.
>
> The debug print is shown - airtime_flags_write: count = 2, len = 8,
> where the actual length is 2, but "len = strlen(buf)" gets 8.
>
> Also cleanup the other similar cases for the sake of consistency.
>
> Signed-off-by: Sujuan Chen <sujuan.chen@mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee@mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen@mediatek.com>
Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
next prev parent reply other threads:[~2021-01-08 12:28 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-01-08 10:56 [PATCH] mac80211: fix incorrect strlen of .write in debugfs Shayne Chen
2021-01-08 12:27 ` Toke Høiland-Jørgensen [this message]
2021-01-08 20:02 ` Johannes Berg
2021-01-09 0:22 ` Ryder Lee
2021-01-11 6:19 ` Shayne Chen
2021-01-11 12:10 ` Johannes Berg
2021-01-12 1:42 ` Shayne Chen
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=8735zbipfx.fsf@toke.dk \
--to=toke@toke.dk \
--cc=johannes@sipsolutions.net \
--cc=linux-mediatek@lists.infradead.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lorenzo.bianconi@redhat.com \
--cc=nbd@nbd.name \
--cc=ryder.lee@mediatek.com \
--cc=shayne.chen@mediatek.com \
--cc=sujuan.chen@mediatek.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;
as well as URLs for NNTP newsgroup(s).