diff options
author | Quanfa Fu <quanfafu@gmail.com> | 2023-02-21 00:52:42 +0100 |
---|---|---|
committer | Masami Hiramatsu (Google) <mhiramat@kernel.org> | 2023-02-21 00:52:42 +0100 |
commit | c96abaec78f34366b3ddf1c6be52ca5c1241e15b (patch) | |
tree | 818396f7971dc8ef6883abf4cbf78728206d9eba /kernel/trace | |
parent | test_kprobes: Add recursed kprobe test case (diff) | |
download | linux-c96abaec78f34366b3ddf1c6be52ca5c1241e15b.tar.xz linux-c96abaec78f34366b3ddf1c6be52ca5c1241e15b.zip |
tracing/eprobe: no need to check for negative ret value for snprintf
No need to check for negative return value from snprintf() as the
code does not return negative values.
Link: https://lore.kernel.org/all/20230109040625.3259642-1-quanfafu@gmail.com/
Signed-off-by: Quanfa Fu <quanfafu@gmail.com>
Acked-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org>
Diffstat (limited to 'kernel/trace')
-rw-r--r-- | kernel/trace/trace_eprobe.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/kernel/trace/trace_eprobe.c b/kernel/trace/trace_eprobe.c index 352b65e2b910..594ac1d086aa 100644 --- a/kernel/trace/trace_eprobe.c +++ b/kernel/trace/trace_eprobe.c @@ -923,17 +923,13 @@ static int trace_eprobe_parse_filter(struct trace_eprobe *ep, int argc, const ch p = ep->filter_str; for (i = 0; i < argc; i++) { - ret = snprintf(p, len, "%s ", argv[i]); - if (ret < 0) - goto error; - if (ret > len) { - ret = -E2BIG; - goto error; - } + if (i) + ret = snprintf(p, len, " %s", argv[i]); + else + ret = snprintf(p, len, "%s", argv[i]); p += ret; len -= ret; } - p[-1] = '\0'; /* * Ensure the filter string can be parsed correctly. Note, this |