Blame SOURCES/xfsprogs-5.7.0-xfs_quota-fix-unsigned-int-id-comparisons.patch

d13294
From eaa5b0b79bcf2eb36f7a5e1a5b7171ad5ced7bac Mon Sep 17 00:00:00 2001
d13294
From: "Darrick J. Wong" <darrick.wong@oracle.com>
d13294
Date: Fri, 10 Jul 2020 15:33:36 -0400
d13294
Subject: [PATCH] xfs_quota: fix unsigned int id comparisons
d13294
d13294
Fix compiler warnings about unsigned int comparisons by replacing them
d13294
with an explicit check for the one possible invalid value (-1U).
d13294
id_from_string sets exitcode to nonzero when it sees this value, so the
d13294
call sites don't have to do that.
d13294
d13294
Coverity-id: 1463855, 1463856, 1463857
d13294
Fixes: 67a73d6139d0 ("xfs_quota: refactor code to generate id from name")
d13294
Fixes: 36dc471cc9bb ("xfs_quota: allow individual timer extension")
d13294
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
d13294
Reviewed-by: Christoph Hellwig <hch@lst.de>
d13294
Signed-off-by: Eric Sandeen <sandeen@sandeen.net>
d13294
---
d13294
 quota/edit.c | 22 +++++++++++-----------
d13294
 1 file changed, 11 insertions(+), 11 deletions(-)
d13294
d13294
Index: xfsprogs-5.0.0/quota/edit.c
d13294
===================================================================
d13294
--- xfsprogs-5.0.0.orig/quota/edit.c
d13294
+++ xfsprogs-5.0.0/quota/edit.c
d13294
@@ -307,11 +307,11 @@ limit_f(
d13294
 
d13294
 
d13294
 	id = id_from_string(name, type);
d13294
-	if (id >= 0)
d13294
-		set_limits(id, type, mask, fs_path->fs_name,
d13294
-			   &bsoft, &bhard, &isoft, &ihard, &rtbsoft, &rtbhard);
d13294
-	else
d13294
-		exitcode = -1;
d13294
+	if (id == -1)
d13294
+		return 0;
d13294
+
d13294
+	set_limits(id, type, mask, fs_path->fs_name,
d13294
+		   &bsoft, &bhard, &isoft, &ihard, &rtbsoft, &rtbhard);
d13294
 	return 0;
d13294
 }
d13294
 
d13294
@@ -545,9 +545,10 @@ timer_f(
d13294
 	if (name)
d13294
 		id = id_from_string(name, type);
d13294
 
d13294
-	if (id >= 0)
d13294
-		set_timer(id, type, mask, fs_path->fs_name, value);
d13294
+	if (id == -1)
d13294
+		return 0;
d13294
 
d13294
+	set_timer(id, type, mask, fs_path->fs_name, value);
d13294
 	return 0;
d13294
 }
d13294
 
d13294
@@ -642,11 +643,10 @@ warn_f(
d13294
 	}
d13294
 
d13294
 	id = id_from_string(name, type);
d13294
-	if (id >= 0)
d13294
-		set_warnings(id, type, mask, fs_path->fs_name, value);
d13294
-	else
d13294
-		exitcode = -1;
d13294
+	if (id == -1)
d13294
+		return 0;
d13294
 
d13294
+	set_warnings(id, type, mask, fs_path->fs_name, value);
d13294
 	return 0;
d13294
 }
d13294