Skip to contentSkip to conversation

Patch "powerpc/perf/hv-24x7: Fix incorrect comparison in memord" has been added to the 4.4-stable tree

PATCH [email protected] 1 participant 1 message Dec 18, 2017

Subsystems (2)
lore
Share & tools
lore

[email protected]

author maintainer Applied
#0 lore raw

This is a note to let you know that I've just added the patch titled

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

to the 4.4-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
powerpc-perf-hv-24x7-fix-incorrect-comparison-in-memord.patch
and it can be found in the queue-4.4 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree, please let <[email protected]> know about it.

Quoted 1 line

From foo@baz Mon Dec 18 14:47:43 CET 2017

From: Michael Ellerman <[email protected]>
Date: Mon, 9 Oct 2017 21:52:44 +1100
Subject: powerpc/perf/hv-24x7: Fix incorrect comparison in memord

From: Michael Ellerman <[email protected]>

[ 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.

---
 arch/powerpc/perf/hv-24x7.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/powerpc/perf/hv-24x7.c +1 -1
@@ -514,7 +514,7 @@ static int memord(const void *d1, size_t
 {
 	if (s1 < s2)
 		return 1;
-	if (s2 > s1)
+	if (s1 > s2)
 		return -1;
 
 	return memcmp(d1, d2, s1);

Patches currently in stable-queue which might be from [email protected] are

queue-4.4/powerpc-perf-hv-24x7-fix-incorrect-comparison-in-memord.patch queue-4.4/powerpc-powernv-cpufreq-fix-the-frequency-read-by-proc-cpuinfo.patch queue-4.4/powerpc-ipic-fix-status-get-and-status-clear.patch queue-4.4/powerpc-opal-fix-ebusy-bug-in-acquiring-tokens.patch