linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Darrick J. Wong" <darrick.wong@oracle.com>
To: sandeen@sandeen.net, darrick.wong@oracle.com
Cc: linux-xfs@vger.kernel.org
Subject: [PATCH 01/17] xfs_quota: fix unsigned int id comparisons
Date: Mon, 01 Jun 2020 21:25:07 -0700	[thread overview]
Message-ID: <159107190741.313760.11195530788081068638.stgit@magnolia> (raw)
In-Reply-To: <159107190111.313760.8056083399475334567.stgit@magnolia>

From: Darrick J. Wong <darrick.wong@oracle.com>

Fix compiler warnings about unsigned int comparisons by replacing them
with an explicit check for the one possible invalid value (-1U).
id_from_string sets exitcode to nonzero when it sees this value, so the
call sites don't have to do that.

Coverity-id: 1463855, 1463856, 1463857
Fixes: 67a73d6139d0 ("xfs_quota: refactor code to generate id from name")
Fixes: 36dc471cc9bb ("xfs_quota: allow individual timer extension")
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
---
 quota/edit.c |   22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)


diff --git a/quota/edit.c b/quota/edit.c
index cf9508bf..01d358f7 100644
--- a/quota/edit.c
+++ b/quota/edit.c
@@ -307,11 +307,11 @@ limit_f(
 
 
 	id = id_from_string(name, type);
-	if (id >= 0)
-		set_limits(id, type, mask, fs_path->fs_name,
-			   &bsoft, &bhard, &isoft, &ihard, &rtbsoft, &rtbhard);
-	else
-		exitcode = -1;
+	if (id == -1)
+		return 0;
+
+	set_limits(id, type, mask, fs_path->fs_name,
+		   &bsoft, &bhard, &isoft, &ihard, &rtbsoft, &rtbhard);
 	return 0;
 }
 
@@ -545,9 +545,10 @@ timer_f(
 	if (name)
 		id = id_from_string(name, type);
 
-	if (id >= 0)
-		set_timer(id, type, mask, fs_path->fs_name, value);
+	if (id == -1)
+		return 0;
 
+	set_timer(id, type, mask, fs_path->fs_name, value);
 	return 0;
 }
 
@@ -642,11 +643,10 @@ warn_f(
 	}
 
 	id = id_from_string(name, type);
-	if (id >= 0)
-		set_warnings(id, type, mask, fs_path->fs_name, value);
-	else
-		exitcode = -1;
+	if (id == -1)
+		return 0;
 
+	set_warnings(id, type, mask, fs_path->fs_name, value);
 	return 0;
 }
 


  reply	other threads:[~2020-06-02  4:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-02  4:25 [PATCH v2 00/17] xfs_repair: catch things that xfs_check misses Darrick J. Wong
2020-06-02  4:25 ` Darrick J. Wong [this message]
2020-06-19 13:32   ` [PATCH 01/17] xfs_quota: fix unsigned int id comparisons Christoph Hellwig
2020-06-02  4:25 ` [PATCH 02/17] xfs_repair: fix missing dir buffer corruption checks Darrick J. Wong
2020-06-02  4:25 ` [PATCH 03/17] xfs_repair: warn when we would have rebuilt a directory Darrick J. Wong
2020-06-02  4:25 ` [PATCH 04/17] xfs_repair: check for AG btree records that would wrap around Darrick J. Wong
2020-06-02  4:25 ` [PATCH 05/17] xfs_repair: fix bnobt and refcountbt record order checks Darrick J. Wong
2020-06-02  4:25 ` [PATCH 06/17] xfs_repair: check for out-of-order inobt records Darrick J. Wong
2020-06-02  4:25 ` [PATCH 07/17] xfs_repair: fix rmapbt record order check Darrick J. Wong
2020-06-02  4:25 ` [PATCH 08/17] xfs_repair: tag inobt vs finobt errors properly Darrick J. Wong
2020-06-02  4:25 ` [PATCH 09/17] xfs_repair: complain about bad interior btree pointers Darrick J. Wong
2020-06-02  4:26 ` [PATCH 10/17] xfs_repair: convert to libxfs_verify_agbno Darrick J. Wong
2020-06-02  4:26 ` [PATCH 11/17] xfs_repair: refactor verify_dfsbno_range Darrick J. Wong
2020-06-02  4:26 ` [PATCH 12/17] xfs_repair: remove verify_dfsbno Darrick J. Wong
2020-06-02  4:26 ` [PATCH 13/17] xfs_repair: remove verify_aginum Darrick J. Wong
2020-06-02  4:26 ` [PATCH 14/17] xfs_repair: mark entire free space btree record as free1 Darrick J. Wong
2020-06-02  4:26 ` [PATCH 15/17] xfs_repair: complain about free space only seen by one btree Darrick J. Wong
2020-06-02  4:26 ` [PATCH 16/17] xfs_repair: complain about extents in unknown state Darrick J. Wong
2020-06-02  4:26 ` [PATCH 17/17] xfs_repair: complain about any nonzero inprogress value, not just 1 Darrick J. Wong

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=159107190741.313760.11195530788081068638.stgit@magnolia \
    --to=darrick.wong@oracle.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=sandeen@sandeen.net \
    /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;
as well as URLs for NNTP newsgroup(s).