]> git.baikalelectronics.ru Git - kernel.git/commit
tracing: Have the histogram compare functions convert to u64 first
authorSteven Rostedt (VMware) <rostedt@goodmis.org>
Wed, 11 Dec 2019 20:44:22 +0000 (15:44 -0500)
committerSteven Rostedt (VMware) <rostedt@goodmis.org>
Thu, 19 Dec 2019 23:26:00 +0000 (18:26 -0500)
commit1c3f3ebfebaede24ade387ca36c95d5b066c953e
treec3b4c17919575dd2ad393048409cb142ce435115
parent761c8f207b64b1832e81a215af2c12828b0b8088
tracing: Have the histogram compare functions convert to u64 first

The compare functions of the histogram code would be specific for the size
of the value being compared (byte, short, int, long long). It would
reference the value from the array via the type of the compare, but the
value was stored in a 64 bit number. This is fine for little endian
machines, but for big endian machines, it would end up comparing zeros or
all ones (depending on the sign) for anything but 64 bit numbers.

To fix this, first derference the value as a u64 then convert it to the type
being compared.

Link: http://lkml.kernel.org/r/20191211103557.7bed6928@gandalf.local.home
Cc: stable@vger.kernel.org
Fixes: fa897838d4018 ("tracing: Add lock-free tracing_map")
Acked-by: Tom Zanussi <zanussi@kernel.org>
Reported-by: Sven Schnelle <svens@stackframe.org>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/tracing_map.c