seq_file: seq_show_option_n() is used for precise sizes
authorKees Cook <keescook@chromium.org>
Wed, 26 Jul 2023 21:59:57 +0000 (14:59 -0700)
committerKees Cook <keescook@chromium.org>
Thu, 27 Jul 2023 15:48:12 +0000 (08:48 -0700)
commit630fdd592912614a72d00026fdadad72d9ef62eb
treec4a1e62c8c507c7793750416fecdd98eeef5203e
parent8453e7924a1a9130f2b4d2c507de2cdc3892a5b5
seq_file: seq_show_option_n() is used for precise sizes

When seq_show_option_n() is used, it is for non-string memory that
happens to be printable bytes. As such, we must use memcpy() to copy the
bytes and then explicitly NUL-terminate the result.

Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Cc: Muchun Song <muchun.song@linux.dev>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230726215957.never.619-kees@kernel.org
Signed-off-by: Kees Cook <keescook@chromium.org>
include/linux/seq_file.h