powerpc/perf/hv-24x7: Fix incorrect comparison in memord
authorMichael Ellerman <mpe@ellerman.id.au>
Mon, 9 Oct 2017 10:52:44 +0000 (21:52 +1100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Dec 2017 09:10:33 +0000 (10:10 +0100)
commit8ee1eada4f1a6671517dc51f6bc11174faebea02
treeda3a20c2bfbf4dae50cd100996183780e83935eb
parentb59dc14b0b102d42d6bd54ae77848ddc00a4596c
powerpc/perf/hv-24x7: Fix incorrect comparison in memord

[ Upstream commit 05c14c03138532a3cb2aa29c2960445c8753343b ]

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>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/powerpc/perf/hv-24x7.c