tracing/boot: Test strscpy() against less than zero for error
authorSteven Rostedt (Google) <rostedt@goodmis.org>
Tue, 4 Jul 2023 14:08:07 +0000 (10:08 -0400)
committerSteven Rostedt (Google) <rostedt@goodmis.org>
Wed, 5 Jul 2023 14:30:49 +0000 (10:30 -0400)
commitfddca7db4a4c17f7333793dfb5308d80c76d2896
tree2740268b7b0d3c3e4b0fe0d4ce7bc3f42b2a4b09
parent931a2ca6a5ba4bfa6062aa9475d4e6a835d75e83
tracing/boot: Test strscpy() against less than zero for error

Instead of checking for -E2BIG, it is better to just check for less than
zero of strscpy() for error. Testing for -E2BIG is not very robust, and
the calling code does not really care about the error code, just that
there was an error.

One of the updates to convert strlcpy() to strscpy() had a v2 version
that changed the test from testing against -E2BIG to less than zero, but I
took the v1 version that still tested for -E2BIG.

Link: https://lore.kernel.org/linux-trace-kernel/20230615180420.400769-1-azeemshaikh38@gmail.com/
Link: https://lore.kernel.org/linux-trace-kernel/20230704100807.707d1605@rorschach.local.home
Cc: Mark Rutland <mark.rutland@arm.com>
Cc: Azeem Shaikh <azeemshaikh38@gmail.com>
Cc: Kees Cook <keescook@chromium.org>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
kernel/trace/trace_boot.c