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]
Date:   Thu, 12 Jan 2017 00:16:05 +0900
From:   Stafford Horne <shorne@...il.com>
To:     Shuah Khan <shuah@...nel.org>, Darren Hart <dvhart@...ux.intel.com>
Cc:     Bamvor Jian Zhang <bamvor.zhangjian@...aro.org>,
        linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org,
        Stafford Horne <shorne@...il.com>,
        Prarit Bhargava <prarit@...hat.com>
Subject: [PATCH v2 4/6] selftests/intel_pstate: Fix warning on loop index overflow

The build was showing the warning:
 aperf.c:60:27: warning: iteration 2147483647 invokes undefined behavior
 [-Waggressive-loop-optimizations]
  for (i=0; i<0x8fffffff; i++) {

This change sets i, cpu and fd to unsigned int as they should not need
to be signed.

Cc: Prarit Bhargava <prarit@...hat.com>
Signed-off-by: Stafford Horne <shorne@...il.com>
---
 tools/testing/selftests/intel_pstate/aperf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/intel_pstate/aperf.c b/tools/testing/selftests/intel_pstate/aperf.c
index 6046e18..cd72f3d 100644
--- a/tools/testing/selftests/intel_pstate/aperf.c
+++ b/tools/testing/selftests/intel_pstate/aperf.c
@@ -14,7 +14,7 @@ void usage(char *name) {
 }
 
 int main(int argc, char **argv) {
-	int i, cpu, fd;
+	unsigned int i, cpu, fd;
 	char msr_file_name[64];
 	long long tsc, old_tsc, new_tsc;
 	long long aperf, old_aperf, new_aperf;
-- 
2.9.3

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ