diff options
| author | Khem Raj <raj.khem@gmail.com> | 2015-09-08 08:34:21 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2015-09-12 22:48:41 +0100 |
| commit | 7d018a6e4b32f56638e8a0465de801264bbdd58e (patch) | |
| tree | 9166cb3fcb04335b04df93228ee1ea3d6d665d21 | |
| parent | 0749e35a375f642677c34bcdae2372ffc831a979 (diff) | |
| download | poky-7d018a6e4b32f56638e8a0465de801264bbdd58e.tar.gz | |
mdadm: Fix bugs exposed by clang
clang points to coding errors which otherwise go unnoticed
(From OE-Core rev: 3738dbf4d204e1c4f1dd2fad6a76291ffbbc414e)
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
| -rw-r--r-- | meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch | 86 | ||||
| -rw-r--r-- | meta/recipes-extended/mdadm/mdadm_3.3.4.bb | 1 |
2 files changed, 87 insertions, 0 deletions
diff --git a/meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch b/meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch new file mode 100644 index 0000000000..df70b1cf44 --- /dev/null +++ b/meta/recipes-extended/mdadm/files/0001-Fix-typo-in-comparision.patch | |||
| @@ -0,0 +1,86 @@ | |||
| 1 | From 18d360d74271a066a849bc1fba4f10dbb23ed251 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Khem Raj <raj.khem@gmail.com> | ||
| 3 | Date: Tue, 8 Sep 2015 08:17:42 +0000 | ||
| 4 | Subject: [PATCH] Fix typo in comparision | ||
| 5 | |||
| 6 | error: comparison of array 'devnm' equal to a null pointer is always false | ||
| 7 | |||
| 8 | User bitwise '&' operator as it is a mask | ||
| 9 | |||
| 10 | Fixes | ||
| 11 | error: use of logical '&&' with constant operand | ||
| 12 | |||
| 13 | Remove extraneous parens | ||
| 14 | |||
| 15 | error: equality comparison with extraneous parentheses | ||
| 16 | |||
| 17 | Remove dead code | ||
| 18 | |||
| 19 | restripe.c:465:21: error: explicitly assigning value of variable of type 'int' to itself | ||
| 20 | |||
| 21 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
| 22 | --- | ||
| 23 | Upstream-Status: Pending | ||
| 24 | |||
| 25 | mdmon.h | 2 +- | ||
| 26 | mdopen.c | 2 +- | ||
| 27 | restripe.c | 3 --- | ||
| 28 | super-intel.c | 2 +- | ||
| 29 | 4 files changed, 3 insertions(+), 6 deletions(-) | ||
| 30 | |||
| 31 | diff --git a/mdmon.h b/mdmon.h | ||
| 32 | index aa750c6..0b08c3d 100644 | ||
| 33 | --- a/mdmon.h | ||
| 34 | +++ b/mdmon.h | ||
| 35 | @@ -101,7 +101,7 @@ static inline int is_resync_complete(struct mdinfo *array) | ||
| 36 | break; | ||
| 37 | case 10: | ||
| 38 | l = array->array.layout; | ||
| 39 | - ncopies = (l & 0xff) * ((l >> 8) && 0xff); | ||
| 40 | + ncopies = (l & 0xff) * ((l >> 8) & 0xff); | ||
| 41 | sync_size = array->component_size * array->array.raid_disks; | ||
| 42 | sync_size /= ncopies; | ||
| 43 | break; | ||
| 44 | diff --git a/mdopen.c b/mdopen.c | ||
| 45 | index 28410f4..c5ee2a6 100644 | ||
| 46 | --- a/mdopen.c | ||
| 47 | +++ b/mdopen.c | ||
| 48 | @@ -318,7 +318,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy, | ||
| 49 | else if (num < 0) { | ||
| 50 | /* need to choose a free number. */ | ||
| 51 | char *_devnm = find_free_devnm(use_mdp); | ||
| 52 | - if (devnm == NULL) { | ||
| 53 | + if (_devnm == NULL) { | ||
| 54 | pr_err("No avail md devices - aborting\n"); | ||
| 55 | return -1; | ||
| 56 | } | ||
| 57 | diff --git a/restripe.c b/restripe.c | ||
| 58 | index 4d92190..cfe9666 100644 | ||
| 59 | --- a/restripe.c | ||
| 60 | +++ b/restripe.c | ||
| 61 | @@ -461,9 +461,6 @@ int raid6_check_disks(int data_disks, int start, int chunk_size, | ||
| 62 | curr_broken_disk = diskD; | ||
| 63 | } | ||
| 64 | |||
| 65 | - if((Px == 0) && (Qx == 0)) | ||
| 66 | - curr_broken_disk = curr_broken_disk; | ||
| 67 | - | ||
| 68 | if(curr_broken_disk >= data_disks + 2) | ||
| 69 | broken_status = 2; | ||
| 70 | |||
| 71 | diff --git a/super-intel.c b/super-intel.c | ||
| 72 | index 3f812d6..1838012 100644 | ||
| 73 | --- a/super-intel.c | ||
| 74 | +++ b/super-intel.c | ||
| 75 | @@ -10027,7 +10027,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st, | ||
| 76 | geo->size = max_size; | ||
| 77 | } | ||
| 78 | |||
| 79 | - if ((direction == ROLLBACK_METADATA_CHANGES)) { | ||
| 80 | + if (direction == ROLLBACK_METADATA_CHANGES) { | ||
| 81 | /* accept size for rollback only | ||
| 82 | */ | ||
| 83 | } else { | ||
| 84 | -- | ||
| 85 | 2.5.1 | ||
| 86 | |||
diff --git a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb index 460a4308b3..11981670e5 100644 --- a/meta/recipes-extended/mdadm/mdadm_3.3.4.bb +++ b/meta/recipes-extended/mdadm/mdadm_3.3.4.bb | |||
| @@ -12,6 +12,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/raid/mdadm/${BPN}-${PV}.tar.xz \ | |||
| 12 | file://mdadm-3.2.2_fix_for_x32.patch \ | 12 | file://mdadm-3.2.2_fix_for_x32.patch \ |
| 13 | file://gcc-4.9.patch \ | 13 | file://gcc-4.9.patch \ |
| 14 | file://mdadm-3.3.2_x32_abi_time_t.patch \ | 14 | file://mdadm-3.3.2_x32_abi_time_t.patch \ |
| 15 | file://0001-Fix-typo-in-comparision.patch \ | ||
| 15 | file://run-ptest \ | 16 | file://run-ptest \ |
| 16 | " | 17 | " |
| 17 | SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09" | 18 | SRC_URI[md5sum] = "7ca8b114710f98f53f20c5787b674a09" |
