Shayne Chen <shayne.chen@xxxxxxxxxxxx> 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@xxxxxxxxxxxx> > Signed-off-by: Ryder Lee <ryder.lee@xxxxxxxxxxxx> > Signed-off-by: Shayne Chen <shayne.chen@xxxxxxxxxxxx> Acked-by: Toke Høiland-Jørgensen <toke@xxxxxxx>