mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Stafford Horne <shorne@gmail.com>
To: Shuah Khan <shuah@kernel.org>, Darren Hart <dvhart@linux.intel.com>
Cc: Bamvor Jian Zhang <bamvor.zhangjian@linaro.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stafford Horne <shorne@gmail.com>,
	Prarit Bhargava <prarit@redhat.com>
Subject: [PATCH v2 4/6] selftests/intel_pstate: Fix warning on loop index overflow
Date: Thu, 12 Jan 2017 00:16:05 +0900	[thread overview]
Message-ID: <6813bc1a6080d3a82900baf4516da59995dfe6ff.1484147115.git.shorne@gmail.com> (raw)
In-Reply-To: <9f3d11fc1f75e2589aee67cbafac6ead3adf0f23.1484147115.git.shorne@gmail.com>
In-Reply-To: <cover.1484147115.git.shorne@gmail.com>

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@redhat.com>
Signed-off-by: Stafford Horne <shorne@gmail.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

  parent reply	other threads:[~2017-01-11 15:16 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-11 15:11 [PATCH v2 0/6] Selftests fixes for futex and intel_pstate Stafford Horne
2017-01-11 15:11 ` [PATCH v2 1/6] selftests/futex: Add stdio used for logging Stafford Horne
     [not found] ` <cover.1484146515.git.shorne@gmail.com>
2017-01-11 15:11   ` [PATCH v2 2/6] cpupower: Restore format of frequency-info limit Stafford Horne
2017-01-11 15:20     ` Stafford Horne
2017-01-11 15:11 ` [PATCH v2 2/6] selftests/futex: Add headers to makefile dependencies Stafford Horne
2017-01-11 15:16 ` [PATCH v2 3/6] cpupower: Restore format of frequency-info limit Stafford Horne
2017-01-11 15:16 ` Stafford Horne [this message]
2017-01-11 15:16 ` [PATCH v2 5/6] selftests/intel_pstate: Update makefile to match new style Stafford Horne
2017-01-11 15:16 ` [PATCH v2 6/6] selftests: Add intel_pstate to TARGETS Stafford Horne
2017-01-19 17:35 ` [PATCH v2 0/6] Selftests fixes for futex and intel_pstate Shuah Khan
2017-01-19 22:42   ` Stafford Horne

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6813bc1a6080d3a82900baf4516da59995dfe6ff.1484147115.git.shorne@gmail.com \
    --to=shorne@gmail.com \
    --cc=bamvor.zhangjian@linaro.org \
    --cc=dvhart@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=prarit@redhat.com \
    --cc=shuah@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®