Skip to content

Commit c96abae

Browse files
dentiscalprummhiramat
authored andcommitted
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>
1 parent 1fcd09f commit c96abae

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

kernel/trace/trace_eprobe.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -923,17 +923,13 @@ static int trace_eprobe_parse_filter(struct trace_eprobe *ep, int argc, const ch
923923

924924
p = ep->filter_str;
925925
for (i = 0; i < argc; i++) {
926-
ret = snprintf(p, len, "%s ", argv[i]);
927-
if (ret < 0)
928-
goto error;
929-
if (ret > len) {
930-
ret = -E2BIG;
931-
goto error;
932-
}
926+
if (i)
927+
ret = snprintf(p, len, " %s", argv[i]);
928+
else
929+
ret = snprintf(p, len, "%s", argv[i]);
933930
p += ret;
934931
len -= ret;
935932
}
936-
p[-1] = '\0';
937933

938934
/*
939935
* Ensure the filter string can be parsed correctly. Note, this

0 commit comments

Comments
 (0)