dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

Blame SOURCES/0027-super-intel-Fix-issue-with-abs-being-irrelevant.patch

f5dd7b
From a4f7290c20c2ff78328c9db0b18029165cfb05b2 Mon Sep 17 00:00:00 2001
f5dd7b
From: Jes Sorensen <jsorensen@fb.com>
f5dd7b
Date: Tue, 9 Jul 2019 13:26:08 -0400
f5dd7b
Subject: [RHEL7.8 PATCH V2 27/47] super-intel: Fix issue with abs() being
f5dd7b
 irrelevant
f5dd7b
f5dd7b
gcc9 complains about subtracting unsigned from unsigned and code
f5dd7b
assuming the result can be negative.
f5dd7b
f5dd7b
Signed-off-by: Jes Sorensen <jsorensen@fb.com>
f5dd7b
---
f5dd7b
 super-intel.c | 4 ++--
f5dd7b
 1 file changed, 2 insertions(+), 2 deletions(-)
f5dd7b
f5dd7b
diff --git a/super-intel.c b/super-intel.c
f5dd7b
index 4fd5e84..230e164 100644
f5dd7b
--- a/super-intel.c
f5dd7b
+++ b/super-intel.c
f5dd7b
@@ -2875,7 +2875,7 @@ static unsigned long long calc_component_size(struct imsm_map *map,
f5dd7b
 {
f5dd7b
 	unsigned long long component_size;
f5dd7b
 	unsigned long long dev_size = imsm_dev_size(dev);
f5dd7b
-	unsigned long long calc_dev_size = 0;
f5dd7b
+	long long calc_dev_size = 0;
f5dd7b
 	unsigned int member_disks = imsm_num_data_members(map);
f5dd7b
 
f5dd7b
 	if (member_disks == 0)
f5dd7b
@@ -2889,7 +2889,7 @@ static unsigned long long calc_component_size(struct imsm_map *map,
f5dd7b
 	 * 2048 blocks per each device. If the difference is higher it means
f5dd7b
 	 * that array size was expanded and num_data_stripes was not updated.
f5dd7b
 	 */
f5dd7b
-	if ((unsigned int)abs(calc_dev_size - dev_size) >
f5dd7b
+	if (llabs(calc_dev_size - (long long)dev_size) >
f5dd7b
 	    (1 << SECT_PER_MB_SHIFT) * member_disks) {
f5dd7b
 		component_size = dev_size / member_disks;
f5dd7b
 		dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n",
f5dd7b
-- 
f5dd7b
2.7.5
f5dd7b