Brad Bishop | 1932369 | 2019-04-05 15:28:33 -0400 | [diff] [blame] | 1 | From b273e892bd6aaafe448f84356abb78a6d463e784 Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Fri, 7 Dec 2018 17:22:39 -0800 |
| 4 | Subject: [PATCH] Compute abs diff in a standard compliant way |
| 5 | |
| 6 | This make it a bit less implementation defined and silences clang |
| 7 | warning -Wabsolute-value |
| 8 | |
| 9 | | super-intel.c:2822:20: error: taking the absolute value of unsigned type 'unsi |
| 10 | gned long long' has no effect [-Werror,-Wabsolute-value] |
| 11 | |
| 12 | Upstream-Status: Pending |
| 13 | |
| 14 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 15 | --- |
| 16 | super-intel.c | 2 +- |
| 17 | 1 file changed, 1 insertion(+), 1 deletion(-) |
| 18 | |
| 19 | diff --git a/super-intel.c b/super-intel.c |
| 20 | index 6438987..10d7218 100644 |
| 21 | --- a/super-intel.c |
| 22 | +++ b/super-intel.c |
| 23 | @@ -2819,7 +2819,7 @@ static unsigned long long calc_component_size(struct imsm_map *map, |
| 24 | * 2048 blocks per each device. If the difference is higher it means |
| 25 | * that array size was expanded and num_data_stripes was not updated. |
| 26 | */ |
| 27 | - if ((unsigned int)abs(calc_dev_size - dev_size) > |
| 28 | + if ((unsigned int)abs((int)calc_dev_size - (int)dev_size) > |
| 29 | (1 << SECT_PER_MB_SHIFT) * member_disks) { |
| 30 | component_size = dev_size / member_disks; |
| 31 | dprintf("Invalid num_data_stripes in metadata; expected=%llu, found=%llu\n", |