[PATCH] mac80211: fix incorrect strlen of .write in debugfs
Toke Høiland-Jørgensen
toke at toke.dk
Fri Jan 8 07:27:30 EST 2021
Shayne Chen <shayne.chen at 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 at mediatek.com>
> Signed-off-by: Ryder Lee <ryder.lee at mediatek.com>
> Signed-off-by: Shayne Chen <shayne.chen at mediatek.com>
Acked-by: Toke Høiland-Jørgensen <toke at toke.dk>
More information about the Linux-mediatek
mailing list