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

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