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-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1346053107-11946-4-git-send-email-feng.tang@intel.com>
Date:	Mon, 27 Aug 2012 15:38:27 +0800
From:	Feng Tang <feng.tang@...el.com>
To:	acme@...hat.com
Cc:	mingo@...e.hu, a.p.zijlstra@...llo.nl, namhyung@...nel.org,
	dsahern@...il.com, linux-kernel@...r.kernel.org,
	Feng Tang <feng.tang@...el.com>
Subject: [PATCH 3/3] perf tools: Fix a misuse of for_each_set_bit() in session.c

In regs_dump__printf() it use for_each_set_bit() for bit ops by
casting a (u64 *) to a (unsigned long *), this works for 64 bits
machine, but will fail on 32 bits ones.

Fix it by using the raw bit comparing method.

Signed-off-by: Feng Tang <feng.tang@...el.com>
---
 tools/perf/util/session.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c
index f7bb7ae..afcea6c 100644
--- a/tools/perf/util/session.c
+++ b/tools/perf/util/session.c
@@ -904,11 +904,10 @@ static void regs_dump__printf(u64 mask, u64 *regs)
 {
 	unsigned rid, i = 0;
 
-	for_each_set_bit(rid, (unsigned long *) &mask, sizeof(mask) * 8) {
-		u64 val = regs[i++];
-
-		printf(".... %-5s 0x%" PRIx64 "\n",
-		       perf_reg_name(rid), val);
+	for (rid = 0; rid < 64; rid++) {
+		if (mask & (1 << rid))
+			printf(".... %-5s 0x%" PRIx64 "\n",
+				perf_reg_name(rid), regs[i++]);
 	}
 }
 
-- 
1.7.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