All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] md/raid10: fix: incompatible types in comparison expression (different address spaces).
@ 2020-12-22  8:00 YANG LI
  2020-12-24  1:08   ` kernel test robot
                   ` (4 more replies)
  0 siblings, 5 replies; 11+ messages in thread
From: YANG LI @ 2020-12-22  8:00 UTC (permalink / raw)
  To: song; +Cc: linux-raid, linux-kernel, YANG LI

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


^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2020-12-27 11:44 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-22  8:00 [PATCH] md/raid10: fix: incompatible types in comparison expression (different address spaces) YANG LI
2020-12-24  1:08 ` kernel test robot
2020-12-24  1:08   ` kernel test robot
2020-12-24 12:28 ` kernel test robot
2020-12-24 12:28   ` kernel test robot
2020-12-24 12:46 ` kernel test robot
2020-12-24 12:46   ` kernel test robot
2020-12-24 16:11 ` kernel test robot
2020-12-24 16:11   ` kernel test robot
2020-12-27 11:42 ` kernel test robot
2020-12-27 11:42   ` kernel test robot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.