]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
perf trace: avoid garbage when not printing a trace event's arguments
authorBenjamin Peterson <benjamin@engflow.com>
Sun, 3 Nov 2024 20:48:16 +0000 (20:48 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:51:05 +0000 (19:51 +0100)
commit8f61c0161f8e297efd5600ff9801129fa9a8b6af
tree56a4b8912c2d134c7881454f01f344dc6664a79d
parent4bd3d783be929a2f0622b1381e9810b3dd3f55a7
perf trace: avoid garbage when not printing a trace event's arguments

[ Upstream commit 5fb8e56542a3cf469fdf25d77f50e21cbff3ae7e ]

trace__fprintf_tp_fields may not print any tracepoint arguments. E.g., if the
argument values are all zero. Previously, this would result in a totally
uninitialized buffer being passed to fprintf, which could lead to garbage on the
console. Fix the problem by passing the number of initialized bytes fprintf.

Fixes: f11b2803bb88 ("perf trace: Allow choosing how to augment the tracepoint arguments")
Signed-off-by: Benjamin Peterson <benjamin@engflow.com>
Tested-by: Howard Chu <howardchu95@gmail.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Link: https://lore.kernel.org/r/20241103204816.7834-1-benjamin@engflow.com
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/perf/builtin-trace.c