summaryrefslogtreecommitdiff
path: root/drivers/virtio/virtio_mem.c
diff options
context:
space:
mode:
authorKuan-Wei Chiu <visitorckw@gmail.com>2024-12-04 04:22:28 +0800
committerSteven Rostedt (Google) <rostedt@goodmis.org>2024-12-04 10:38:24 -0500
commite63fbd5f6810ed756bbb8a1549c7d4132968baa9 (patch)
tree350c403d7353105070c047ab48a9bd5fed71ef14 /drivers/virtio/virtio_mem.c
parent40384c840ea1944d7c5a392e8975ed088ecf0b37 (diff)
tracing: Fix cmp_entries_dup() to respect sort() comparison rules
The cmp_entries_dup() function used as the comparator for sort() violated the symmetry and transitivity properties required by the sorting algorithm. Specifically, it returned 1 whenever memcmp() was non-zero, which broke the following expectations: * Symmetry: If x < y, then y > x. * Transitivity: If x < y and y < z, then x < z. These violations could lead to incorrect sorting and failure to correctly identify duplicate elements. Fix the issue by directly returning the result of memcmp(), which adheres to the required comparison properties. Cc: stable@vger.kernel.org Fixes: 08d43a5fa063 ("tracing: Add lock-free tracing_map") Link: https://lore.kernel.org/20241203202228.1274403-1-visitorckw@gmail.com Signed-off-by: Kuan-Wei Chiu <visitorckw@gmail.com> Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'drivers/virtio/virtio_mem.c')
0 files changed, 0 insertions, 0 deletions