dcavalca / rpms / mdadm

Forked from rpms/mdadm 3 years ago
Clone

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

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