Linux RAID subsystem development
 help / color / mirror / Atom feed
From: NeilBrown <neilb@suse.com>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: Linux-RAID <linux-raid@vger.kernel.org>
Subject: [PATCH - mdadm] Fix some issues found by clang
Date: Fri, 07 Oct 2016 14:55:20 +1100	[thread overview]
Message-ID: <8737k84xuf.fsf@notabene.neil.brown.name> (raw)

[-- Attachment #1: Type: text/plain, Size: 2325 bytes --]


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>
---
 mdmon.h       | 2 +-
 mdopen.c      | 2 +-
 restripe.c    | 2 +-
 super-intel.c | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mdmon.h b/mdmon.h
index aa750c6811e1..0b08c3d7da2a 100644
--- 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;
diff --git a/mdopen.c b/mdopen.c
index f818fdf339eb..287b5211631a 100644
--- 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;
 		}
diff --git a/restripe.c b/restripe.c
index 56dca73ea86b..94342c7bc6f9 100644
--- a/restripe.c
+++ b/restripe.c
@@ -462,7 +462,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;
diff --git a/super-intel.c b/super-intel.c
index 92817e9ec875..b24777ee3559 100644
--- a/super-intel.c
+++ b/super-intel.c
@@ -10141,7 +10141,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 {
-- 
2.10.0


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 800 bytes --]

             reply	other threads:[~2016-10-07  3:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07  3:55 NeilBrown [this message]
2016-10-07 15:48 ` [PATCH - mdadm] Fix some issues found by clang Jes Sorensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8737k84xuf.fsf@notabene.neil.brown.name \
    --to=neilb@suse.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=linux-raid@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox