Skip to content

Commit 66bcf65

Browse files
committed
tracing/probes: Fix to avoid double count of the string length on the array
If an array is specified with the ustring or symstr, the length of the strings are accumlated on both of 'ret' and 'total', which means the length is double counted. Just set the length to the 'ret' value for avoiding double counting. Link: https://lore.kernel.org/all/168908492917.123124.15076463491122036025.stgit@devnote2/ Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://lore.kernel.org/all/8819b154-2ba1-43c3-98a2-cbde20892023@moroto.mountain/ Fixes: 88903c4 ("tracing/probe: Add ustring type for user-space string") Cc: stable@vger.kernel.org Signed-off-by: Masami Hiramatsu (Google) <mhiramat@kernel.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent d5f28bb commit 66bcf65

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/trace/trace_probe_tmpl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ process_fetch_insn_bottom(struct fetch_insn *code, unsigned long val,
156156
code++;
157157
goto array;
158158
case FETCH_OP_ST_USTRING:
159-
ret += fetch_store_strlen_user(val + code->offset);
159+
ret = fetch_store_strlen_user(val + code->offset);
160160
code++;
161161
goto array;
162162
case FETCH_OP_ST_SYMSTR:
163-
ret += fetch_store_symstrlen(val + code->offset);
163+
ret = fetch_store_symstrlen(val + code->offset);
164164
code++;
165165
goto array;
166166
default:

0 commit comments

Comments
 (0)