dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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