]> git.ipfire.org Git - thirdparty/mdadm.git/commitdiff
Fix some issues found by clang
authorNeilBrown <neilb@suse.com>
Fri, 7 Oct 2016 03:55:20 +0000 (14:55 +1100)
committerJes Sorensen <Jes.Sorensen@redhat.com>
Fri, 7 Oct 2016 15:47:48 +0000 (11:47 -0400)
The clang compiler complained about each of these.

The mdmon.h error will only affect 'far' RAID10 arrays using intel or DDF
metadata, and there is no such thing.

The mdopen.c will cause a problem if there are no free md device
numbers in the first 512.  That is fairly unlikely.

The restripe.c error would only affect the 'test_stripe' command, and
probably doesn't change its behaviour.

The super-intel.c fix is purely cosmetic.

Signed-off-by: NeilBrown <neilb@suse.com>
Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com>
mdmon.h
mdopen.c
restripe.c
super-intel.c

diff --git a/mdmon.h b/mdmon.h
index aa750c6811e146c9cc9b402783600d47ef75b6cd..0b08c3d7da2a62e6b3934e0b2716cd85fd2dc759 100644 (file)
--- a/mdmon.h
+++ b/mdmon.h
@@ -101,7 +101,7 @@ static inline int is_resync_complete(struct mdinfo *array)
                break;
        case 10:
                l = array->array.layout;
-               ncopies = (l & 0xff) * ((l >> 8) && 0xff);
+               ncopies = (l & 0xff) * ((l >> 8) & 0xff);
                sync_size = array->component_size * array->array.raid_disks;
                sync_size /= ncopies;
                break;
index 5af344b9c9dbf2205b20c873c7300bf10c28d4b9..0ea38749a58226f9766a36621ef1e4ae521082d2 100644 (file)
--- a/mdopen.c
+++ b/mdopen.c
@@ -318,7 +318,7 @@ int create_mddev(char *dev, char *name, int autof, int trustworthy,
        else if (num < 0) {
                /* need to choose a free number. */
                char *_devnm = find_free_devnm(use_mdp);
-               if (devnm == NULL) {
+               if (_devnm == NULL) {
                        pr_err("No avail md devices - aborting\n");
                        return -1;
                }
index 359ae86ed5845d109336639629bc737f3895e39a..de85ee46259f92e39d30e92b56c7582ce8306efe 100644 (file)
@@ -482,7 +482,7 @@ int raid6_check_disks(int data_disks, int start, int chunk_size,
                }
 
                if((Px == 0) && (Qx == 0))
-                       curr_broken_disk = curr_broken_disk;
+                       curr_broken_disk = prev_broken_disk;
 
                if(curr_broken_disk >= data_disks + 2)
                        broken_status = 2;
index 1304737f6fc1ee525cbe7fbbc9556e221365dc66..e1124ba5e587343826b44afccff7640f20c52e95 100644 (file)
@@ -10154,7 +10154,7 @@ enum imsm_reshape_type imsm_analyze_change(struct supertype *st,
                                geo->size = max_size;
                }
 
-               if ((direction == ROLLBACK_METADATA_CHANGES)) {
+               if (direction == ROLLBACK_METADATA_CHANGES) {
                        /* accept size for rollback only
                        */
                } else {