Commit f604de20 authored by Viktor Rosendahl's avatar Viktor Rosendahl Committed by Steven Rostedt (VMware)

tools/latency-collector: Use correct size when writing queue_full_warning

queue_full_warning is a pointer, so it is wrong to use sizeof to calculate
the number of characters of the string it points to. The effect is that we
only print out the first few characters of the warning string.

The correct way is to use strlen(). We don't need to add 1 to the strlen()
because we don't want to write the terminating null character to stdout.

Link: https://lkml.kernel.org/r/20211019160701.15587-1-Viktor.Rosendahl@bmw.de

Link: https://lore.kernel.org/r/8fd4bb65ef3da67feac9ce3258cdbe9824752cf1.1629198502.git.jing.yangyang@zte.com.cn
Link: https://lore.kernel.org/r/20211012025424.180781-1-davidcomponentone@gmail.comReported-by: default avatarZeal Robot <zealci@zte.com.cn>
Signed-off-by: default avatarViktor Rosendahl <Viktor.Rosendahl@bmw.de>
Signed-off-by: default avatarSteven Rostedt (VMware) <rostedt@goodmis.org>
parent 172f7ba9
...@@ -1538,7 +1538,7 @@ static void tracing_loop(void) ...@@ -1538,7 +1538,7 @@ static void tracing_loop(void)
mutex_lock(&print_mtx); mutex_lock(&print_mtx);
check_signals(); check_signals();
write_or_die(fd_stdout, queue_full_warning, write_or_die(fd_stdout, queue_full_warning,
sizeof(queue_full_warning)); strlen(queue_full_warning));
mutex_unlock(&print_mtx); mutex_unlock(&print_mtx);
} }
modified--; modified--;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment