Commit d7e1c86d authored by Michael Ellerman's avatar Michael Ellerman Committed by Kleber Sacilotto de Souza

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

BugLink: http://bugs.launchpad.net/bugs/1745052

[ Upstream commit 05c14c03 ]

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: default avatarDavid Binderman <dcb314@hotmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent b63d5a0b
...@@ -524,7 +524,7 @@ static int memord(const void *d1, size_t s1, const void *d2, size_t s2) ...@@ -524,7 +524,7 @@ static int memord(const void *d1, size_t s1, const void *d2, size_t s2)
{ {
if (s1 < s2) if (s1 < s2)
return 1; return 1;
if (s2 > s1) if (s1 > s2)
return -1; return -1;
return memcmp(d1, d2, s1); return memcmp(d1, d2, s1);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment