lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100518204330.GA30624@redhat.com>
Date:	Tue, 18 May 2010 16:43:30 -0400
From:	Jason Baron <jbaron@...hat.com>
To:	eranian@...glemail.com
Cc:	linux-kernel@...r.kernel.org, a.p.zijlstra@...llo.nl,
	mingo@...e.hu, paulus@...ba.org, perfmon2-devel@...ts.sf.net
Subject: [PATCH] perf: fix cmpxchg warning in perf_event_amd.c

Hi,

I'm getting the following warnings:

In file included from arch/x86/kernel/cpu/perf_event.c:1343:
arch/x86/kernel/cpu/perf_event_amd.c: In function
‘amd_put_event_constraints’:
arch/x86/kernel/cpu/perf_event_amd.c:167: warning: value computed is not
used

Since cmpxchg returns a value, we need to use it. We can use it to test if its
equal to "event".

thanks,

-Jason

Signed-off-by: Jason Baron <jbaron@...hat.com>
---
 arch/x86/kernel/cpu/perf_event_amd.c |    4 +---
 1 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 611df11..e13ce4a 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -163,10 +163,8 @@ static void amd_put_event_constraints(struct cpu_hw_events *cpuc,
 	 * when we come here
 	 */
 	for (i = 0; i < x86_pmu.num_counters; i++) {
-		if (nb->owners[i] == event) {
-			cmpxchg(nb->owners+i, event, NULL);
+		if (cmpxchg(nb->owners+i, event, NULL) == event)
 			break;
-		}
 	}
 }
 
-- 
1.7.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ