Skip to content

Commit

Permalink
tracing/eprobe: no need to check for negative ret value for snprintf
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Quanfa Fu authored and Masami Hiramatsu (Google) committed Feb 20, 2023
1 parent 1fcd09f commit c96abae
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions kernel/trace/trace_eprobe.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c96abae

Please sign in to comment.