Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/perf/hv-24x7: Fix incorrect comparison in memord

In the hv-24x7 code there is a function memord() which tries to
implement a sort function return -1, 0, 1. However one of the
conditions is incorrect, such that it can never be true, because we
will have already returned.

I don't believe there is a bug in practice though, because the
comparisons are an optimisation prior to calling memcmp().

Fix it by swapping the second comparision, so it can be true.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

+1 -1
+1 -1
arch/powerpc/perf/hv-24x7.c
··· 540 540 { 541 541 if (s1 < s2) 542 542 return 1; 543 - if (s2 > s1) 543 + if (s1 > s2) 544 544 return -1; 545 545 546 546 return memcmp(d1, d2, s1);