With 2cf15144daf7e we added a kernel buffer for parsing input copying the
user buffer into that. The problem is that we only copy exactly as many
bytes as the user supplied. printf 1 would have a write_size of 1, while
echo 1 would have a write_size of 2 (1\n). But in order to check and
parse we need a terminating '\0'.
Overallocate the kernel buffer by 1 and make sure it is always '\0'
terminated.
Remove the check that the string needs to be of different length than
the write_size as this will always fail unless the user passes in, e.g.,
"1\02\n\0" somehow in which case we won't bother as kstrto*ll() will
not only handle the '\n' but also stop at '\0' and should be fine or
it will fail and we will error.
In theory we could use a static buffer here as well as we know a maximum
possible length of digits plus \n and \0 and take a min of that buffer
length and write_size and then error on a small buffer but given this is
an optional debug interface, do not bother with any alloc (size).
Fixes: 2cf15144daf7e ("lindebugfs: Pass user buffer pointers ..")
Sponsored by: The FreeBSD Foundation
MFC after: 3 days