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

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