lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Mon, 11 Oct 2021 12:42:57 +0200
From:   Sebastian Andrzej Siewior <bigeasy@...utronix.de>
To:     kernel test robot <lkp@...el.com>
Cc:     Thomas Gleixner <tglx@...utronix.de>, kbuild-all@...ts.01.org,
        linux-kernel@...r.kernel.org
Subject: Re: [rt-devel:linux-5.15.y-rt-rebase 85/155]
 drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1
 (different address spaces)

On 2021-10-09 22:20:57 [+0800], kernel test robot wrote:
> sparse warnings: (new ones prefixed by >>)
> >> drivers/md/raid5.c:2222:20: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
>    drivers/md/raid5.c:2222:20: sparse:     expected struct spinlock [usertype] *lock
>    drivers/md/raid5.c:2222:20: sparse:     got struct spinlock [noderef] __percpu *
>    drivers/md/raid5.c:2281:22: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct spinlock [usertype] *lock @@     got struct spinlock [noderef] __percpu * @@
>    drivers/md/raid5.c:2281:22: sparse:     expected struct spinlock [usertype] *lock
>    drivers/md/raid5.c:2281:22: sparse:     got struct spinlock [noderef] __percpu *

I think the code itself is correct but sparse got confused by the
definition of the struct. Defining raid5_percpu on its own makes the
warning go away:

diff --git a/drivers/md/raid5.h b/drivers/md/raid5.h
--- a/drivers/md/raid5.h
+++ b/drivers/md/raid5.h
@@ -559,6 +559,17 @@ struct r5pending_data {
 	struct bio_list bios;
 };
 
+/* per cpu variables */
+struct raid5_percpu {
+	spinlock_t	lock;		/* Protection for -RT */
+	struct page	*spare_page; /* Used when checking P/Q in raid6 */
+	void		*scribble;  /* space for constructing buffer
+				     * lists and performing address
+				     * conversions
+				     */
+	int scribble_obj_size;
+};
+
 struct r5conf {
 	struct hlist_head	*stripe_hashtbl;
 	/* only protect corresponding hash list and inactive_list */
@@ -634,15 +645,7 @@ struct r5conf {
 					    */
 	int			recovery_disabled;
 	/* per cpu variables */
-	struct raid5_percpu {
-		spinlock_t	lock;		/* Protection for -RT */
-		struct page	*spare_page; /* Used when checking P/Q in raid6 */
-		void		*scribble;  /* space for constructing buffer
-					     * lists and performing address
-					     * conversions
-					     */
-		int scribble_obj_size;
-	} __percpu *percpu;
+	struct raid5_percpu	__percpu *percpu;
 	int scribble_disks;
 	int scribble_sectors;
 	struct hlist_node node;

The RCU warnings look valid since there are __rcu annotations.

Sebastian

Powered by blists - more mailing lists