]> 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)
commit49bbd1e757d10085791da148c6041288a63b7304
treec3b4c17919575dd2ad393048409cb142ce435115
parent3c8f32c8f3926930186df7b150f797ad67d2dec8
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: abf4d4d876b1f ("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