[obsolete] waitqueue-fix-clang-wuninitialized-warnings.patch removed from -mm tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch titled
     Subject: include/linux/wait.h: fix clang -Wuninitialized warnings
has been removed from the -mm tree.  Its filename was
     waitqueue-fix-clang-wuninitialized-warnings.patch

This patch was dropped because it is obsolete

------------------------------------------------------
From: Arnd Bergmann <arnd@xxxxxxxx>
Subject: include/linux/wait.h: fix clang -Wuninitialized warnings

When CONFIG_LOCKDEP is set, every use of DECLARE_WAIT_QUEUE_HEAD_ONSTACK()
produces an annoying warning from clang, which is particularly annoying
for allmodconfig builds:

fs/namei.c:1646:34: error: variable 'wq' is uninitialized when used within its own initialization [-Werror,-Wuninitialized]
        DECLARE_WAIT_QUEUE_HEAD_ONSTACK(wq);
                                        ^~
include/linux/wait.h:74:63: note: expanded from macro 'DECLARE_WAIT_QUEUE_HEAD_ONSTACK'
        struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)
                               ~~~~                                  ^~~~
include/linux/wait.h:72:33: note: expanded from macro '__WAIT_QUEUE_HEAD_INIT_ONSTACK'
        ({ init_waitqueue_head(&name); name; })
                                       ^~~~

After playing with it for a while, I have found a way to rephrase the
macro in a way that should work well with both gcc and clang and not
produce this warning.  The open-coded __WAIT_QUEUE_HEAD_INIT_ONSTACK is a
little more verbose than the original version by Peter Zijlstra, but
avoids the gcc-ism that suppresses warnings when assigning a variable to
itself.

Link: http://lkml.kernel.org/r/20190703081119.209976-1-arnd@xxxxxxxx
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
Reviewed-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
Tested-by: Nathan Chancellor <natechancellor@xxxxxxxxx>
Cc: Nick Desaulniers <ndesaulniers@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
---

 include/linux/wait.h |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

--- a/include/linux/wait.h~waitqueue-fix-clang-wuninitialized-warnings
+++ a/include/linux/wait.h
@@ -68,8 +68,15 @@ extern void __init_waitqueue_head(struct
 	} while (0)
 
 #ifdef CONFIG_LOCKDEP
-# define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) \
-	({ init_waitqueue_head(&name); name; })
+# define __WAIT_QUEUE_HEAD_INIT_ONSTACK(name) {					\
+	.lock		= __SPIN_LOCK_UNLOCKED(name.lock),			\
+	.head		= ({							\
+		static struct lock_class_key __key;				\
+		lockdep_set_class_and_name(&(name).lock, &__key, # name);	\
+		(struct list_head){ &(name).head, &(name).head };		\
+	}),									\
+}
+
 # define DECLARE_WAIT_QUEUE_HEAD_ONSTACK(name) \
 	struct wait_queue_head name = __WAIT_QUEUE_HEAD_INIT_ONSTACK(name)
 #else
_

Patches currently in -mm which might be from arnd@xxxxxxxx are

thp-fix-unused-shmem_parse_huge-function-warning.patch
lib-mpi-fix-building-with-32-bit-x86.patch
slab-work-around-clang-bug-42570.patch
mm-sparse-fix-memory-leak-of-sparsemap_buf-in-aliged-memory-fix.patch
lib-test_meminit-fix-wmaybe-uninitialized-false-positive.patch
coda-stop-using-struct-timespec-in-user-api.patch
proc-sysctl-add-shared-variables-for-range-check-fix-3.patch




[Index of Archives]     [Kernel Archive]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]

  Powered by Linux