public inbox for linux-raid@vger.kernel.org
 help / color / mirror / Atom feed
From: YANG LI <abaci-bugfix@linux.alibaba.com>
To: song@kernel.org
Cc: linux-raid@vger.kernel.org, linux-kernel@vger.kernel.org,
	YANG LI <abaci-bugfix@linux.alibaba.com>
Subject: [PATCH] md/raid10: fix: incompatible types in comparison expression (different address spaces).
Date: Tue, 22 Dec 2020 16:00:10 +0800	[thread overview]
Message-ID: <1608624010-69405-1-git-send-email-abaci-bugfix@linux.alibaba.com> (raw)

Fixes the following sparse errors in drivers/md/raid10.c error:
incompatible types in comparison expression (different address spaces).

The error was because of the following line in function read_balance():

rdev = rcu_dereference(conf->mirrors[disk].replacement);
    if (rdev == NULL || test_bit(Faulty, &rdev->flags) ||
        r10_bio->devs[slot].addr + sectors > rdev->recovery_offset)
    rdev = rcu_dereference(conf->mirrors[disk].rdev);

Annotating the struct md_rdev *rdev and *replacement in
drivers/md/raid10.h with __rcu fixes the sparse error.

Signed-off-by: YANG LI <abaci-bugfix@linux.alibaba.com>
Reported-by: Abaci <abaci@linux.alibaba.com>
---
 drivers/md/raid10.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/md/raid10.h b/drivers/md/raid10.h
index 79cd2b7..910bd5f 100644
--- a/drivers/md/raid10.h
+++ b/drivers/md/raid10.h
@@ -16,7 +16,8 @@
  */
 
 struct raid10_info {
-	struct md_rdev	*rdev, *replacement;
+	struct md_rdev	__rcu *rdev;
+	struct md_rdev	__rcu *replacement;
 	sector_t	head_position;
 	int		recovery_disabled;	/* matches
 						 * mddev->recovery_disabled
-- 
1.8.3.1


             reply	other threads:[~2020-12-22  8:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-22  8:00 YANG LI [this message]
2020-12-24  1:08 ` [PATCH] md/raid10: fix: incompatible types in comparison expression (different address spaces) kernel test robot
2020-12-24 12:28 ` kernel test robot
2020-12-24 12:46 ` kernel test robot
2020-12-24 16:11 ` kernel test robot
2020-12-27 11:42 ` kernel test robot

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=1608624010-69405-1-git-send-email-abaci-bugfix@linux.alibaba.com \
    --to=abaci-bugfix@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-raid@vger.kernel.org \
    --cc=song@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