dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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