public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Nicolas Kaiser <nikai@nikai.net>
To: Robert Richter <robert.richter@amd.com>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>,
	Heiko Carstens <heiko.carstens@de.ibm.com>,
	linux390@de.ibm.com, oprofile-list@lists.sf.net,
	linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH resend] s390: oprofile: fix error checks in oprofile_hwsampler_init()
Date: Mon, 2 May 2011 15:48:05 +0200	[thread overview]
Message-ID: <20110502154805.71664123@absol.kitzblitz> (raw)

Checking 'oprofile_min_interval < 0' and
'oprofile_max_interval < 0' doesn't work because
'oprofile_min_interval' and 'oprofile_max_interval' are unsigned.

Signed-off-by: Nicolas Kaiser <nikai@nikai.net>
---
Untested.

 arch/s390/oprofile/init.c |   12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/arch/s390/oprofile/init.c b/arch/s390/oprofile/init.c
index c63d7e5..09c3088 100644
--- a/arch/s390/oprofile/init.c
+++ b/arch/s390/oprofile/init.c
@@ -138,22 +138,26 @@ static int oprofile_create_hwsampling_files(struct super_block *sb,
 
 static int oprofile_hwsampler_init(struct oprofile_operations *ops)
 {
+	long retval;
+
 	if (hwsampler_setup())
 		return -ENODEV;
 
 	/*
 	 * create hwsampler files only if hwsampler_setup() succeeds.
 	 */
-	oprofile_min_interval = hwsampler_query_min_interval();
-	if (oprofile_min_interval < 0) {
+	retval = hwsampler_query_min_interval();
+	if (retval < 0) {
 		oprofile_min_interval = 0;
 		return -ENODEV;
 	}
-	oprofile_max_interval = hwsampler_query_max_interval();
-	if (oprofile_max_interval < 0) {
+	oprofile_min_interval = retval;
+	retval = hwsampler_query_max_interval();
+	if (retval < 0) {
 		oprofile_max_interval = 0;
 		return -ENODEV;
 	}
+	oprofile_max_interval = retval;
 
 	if (oprofile_timer_init(ops))
 		return -ENODEV;
-- 
1.7.3.4

             reply	other threads:[~2011-05-02 13:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-02 13:48 Nicolas Kaiser [this message]
2011-05-02 15:01 ` [PATCH resend] s390: oprofile: fix error checks in oprofile_hwsampler_init() Martin Schwidefsky
2011-05-03  8:55 ` Robert Richter
     [not found]   ` <BANLkTikC6vQF3p91q8e2E1Rp2M2HYyKipQ@mail.gmail.com>
2011-05-04 16:00     ` Maynard Johnson
2011-05-10  8:55   ` Martin Schwidefsky
2011-05-10  9:00     ` Robert Richter
2011-05-10  9:19       ` Martin Schwidefsky

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=20110502154805.71664123@absol.kitzblitz \
    --to=nikai@nikai.net \
    --cc=heiko.carstens@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=linux390@de.ibm.com \
    --cc=oprofile-list@lists.sf.net \
    --cc=robert.richter@amd.com \
    --cc=schwidefsky@de.ibm.com \
    /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