LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] kbuild: Enable -Wsometimes-uninitialized
@ 2019-04-30  1:00 Nathan Chancellor
  2019-04-30  7:16 ` Arnd Bergmann
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2019-04-30  1:00 UTC (permalink / raw)
  To: Masahiro Yamada, Michal Marek
  Cc: linux-kbuild, linux-kernel, clang-built-linux, Nick Desaulniers,
	Arnd Bergmann, Nathan Chancellor

This is Clang's version of GCC's -Wmaybe-uninitialized. Up to this
point, it has not been used because -Wuninitialized has been disabled,
which also turns off -Wsometimes-uninitialized, meaning that we miss out
on finding some bugs [1]. In my experience, it appears to be more
accurate than GCC and catch some things that GCC can't.

All of these warnings have now been fixed in -next across arm, arm64,
and x86_64 defconfig/allyesconfig so this should be enabled for everyone
to prevent more from easily creeping in.

As of next-20190429:

$ git log --oneline --grep="sometimes-uninitialized" | wc -l
45

[1]: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/

Link: https://github.com/ClangBuiltLinux/linux/issues/381
Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
---

Masahiro, I am not sure how you want to handle merging this with regards
to all of the patches floating around in -next but I wanted to send this
out to let everyone know this is ready to be turned on.

Arnd, are there many remaning -Wsometimes-uninitialized warnings in
randconfigs?

 scripts/Makefile.extrawarn | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
index 768306add591..f4332981ea85 100644
--- a/scripts/Makefile.extrawarn
+++ b/scripts/Makefile.extrawarn
@@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
 KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
 KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
 KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
+KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
 endif
 endif
-- 
2.21.0


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

* Re: [PATCH] kbuild: Enable -Wsometimes-uninitialized
  2019-04-30  1:00 [PATCH] kbuild: Enable -Wsometimes-uninitialized Nathan Chancellor
@ 2019-04-30  7:16 ` Arnd Bergmann
  2019-04-30  9:33   ` Nathan Chancellor
  0 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2019-04-30  7:16 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux, Nick Desaulniers

On Tue, Apr 30, 2019 at 3:01 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> This is Clang's version of GCC's -Wmaybe-uninitialized. Up to this
> point, it has not been used because -Wuninitialized has been disabled,
> which also turns off -Wsometimes-uninitialized, meaning that we miss out
> on finding some bugs [1]. In my experience, it appears to be more
> accurate than GCC and catch some things that GCC can't.
>
> All of these warnings have now been fixed in -next across arm, arm64,
> and x86_64 defconfig/allyesconfig so this should be enabled for everyone
> to prevent more from easily creeping in.
>
> As of next-20190429:
>
> $ git log --oneline --grep="sometimes-uninitialized" | wc -l
> 45
>
> [1]: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/
>
> Link: https://github.com/ClangBuiltLinux/linux/issues/381
> Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> ---
>
> Masahiro, I am not sure how you want to handle merging this with regards
> to all of the patches floating around in -next but I wanted to send this
> out to let everyone know this is ready to be turned on.
>
> Arnd, are there many remaning -Wsometimes-uninitialized warnings in
> randconfigs?

No, I don't see any with the patches that I submitted. I haven't checked
if there are any that still need to get merged into linux-next though.

> diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> index 768306add591..f4332981ea85 100644
> --- a/scripts/Makefile.extrawarn
> +++ b/scripts/Makefile.extrawarn
> @@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
>  KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
>  KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
>  KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
> +KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
>  endif
>  endif

This doesn't look right. Shouldn't you remove the line that turns off
-Wuninitilized
instead of adding only -Wsometimes-uninitialized?

If we warn about the instances that may or may not be wrong, we should
also warn about those that are provably wrong.

        Arnd

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

* Re: [PATCH] kbuild: Enable -Wsometimes-uninitialized
  2019-04-30  7:16 ` Arnd Bergmann
@ 2019-04-30  9:33   ` Nathan Chancellor
  2019-04-30  9:46     ` Arnd Bergmann
  0 siblings, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2019-04-30  9:33 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux, Nick Desaulniers

On Tue, Apr 30, 2019 at 09:16:50AM +0200, Arnd Bergmann wrote:
> On Tue, Apr 30, 2019 at 3:01 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> >
> > This is Clang's version of GCC's -Wmaybe-uninitialized. Up to this
> > point, it has not been used because -Wuninitialized has been disabled,
> > which also turns off -Wsometimes-uninitialized, meaning that we miss out
> > on finding some bugs [1]. In my experience, it appears to be more
> > accurate than GCC and catch some things that GCC can't.
> >
> > All of these warnings have now been fixed in -next across arm, arm64,
> > and x86_64 defconfig/allyesconfig so this should be enabled for everyone
> > to prevent more from easily creeping in.
> >
> > As of next-20190429:
> >
> > $ git log --oneline --grep="sometimes-uninitialized" | wc -l
> > 45
> >
> > [1]: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/
> >
> > Link: https://github.com/ClangBuiltLinux/linux/issues/381
> > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > ---
> >
> > Masahiro, I am not sure how you want to handle merging this with regards
> > to all of the patches floating around in -next but I wanted to send this
> > out to let everyone know this is ready to be turned on.
> >
> > Arnd, are there many remaning -Wsometimes-uninitialized warnings in
> > randconfigs?
> 
> No, I don't see any with the patches that I submitted. I haven't checked
> if there are any that still need to get merged into linux-next though.
> 
> > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> > index 768306add591..f4332981ea85 100644
> > --- a/scripts/Makefile.extrawarn
> > +++ b/scripts/Makefile.extrawarn
> > @@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
> >  KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
> >  KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
> >  KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
> > +KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
> >  endif
> >  endif
> 
> This doesn't look right. Shouldn't you remove the line that turns off
> -Wuninitilized
> instead of adding only -Wsometimes-uninitialized?

Well, there are still some outstanding issues with -Wuninitialized
right? Like with DECLARE_WAIT_QUEUE_HEAD_ONSTACK? I'd rather not
add warnings to the build but if you feel strongly, we could turn it on
then fix them after.

Nathan

> 
> If we warn about the instances that may or may not be wrong, we should
> also warn about those that are provably wrong.
> 
>         Arnd

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

* Re: [PATCH] kbuild: Enable -Wsometimes-uninitialized
  2019-04-30  9:33   ` Nathan Chancellor
@ 2019-04-30  9:46     ` Arnd Bergmann
  2019-04-30 20:54       ` Nathan Chancellor
  2019-05-23  1:50       ` Nathan Chancellor
  0 siblings, 2 replies; 7+ messages in thread
From: Arnd Bergmann @ 2019-04-30  9:46 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux, Nick Desaulniers

On Tue, Apr 30, 2019 at 11:33 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
> On Tue, Apr 30, 2019 at 09:16:50AM +0200, Arnd Bergmann wrote:
> > On Tue, Apr 30, 2019 at 3:01 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > >
> > > This is Clang's version of GCC's -Wmaybe-uninitialized. Up to this
> > > point, it has not been used because -Wuninitialized has been disabled,
> > > which also turns off -Wsometimes-uninitialized, meaning that we miss out
> > > on finding some bugs [1]. In my experience, it appears to be more
> > > accurate than GCC and catch some things that GCC can't.
> > >
> > > All of these warnings have now been fixed in -next across arm, arm64,
> > > and x86_64 defconfig/allyesconfig so this should be enabled for everyone
> > > to prevent more from easily creeping in.
> > >
> > > As of next-20190429:
> > >
> > > $ git log --oneline --grep="sometimes-uninitialized" | wc -l
> > > 45
> > >
> > > [1]: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/
> > >
> > > Link: https://github.com/ClangBuiltLinux/linux/issues/381
> > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > ---
> > >
> > > Masahiro, I am not sure how you want to handle merging this with regards
> > > to all of the patches floating around in -next but I wanted to send this
> > > out to let everyone know this is ready to be turned on.
> > >
> > > Arnd, are there many remaning -Wsometimes-uninitialized warnings in
> > > randconfigs?
> >
> > No, I don't see any with the patches that I submitted. I haven't checked
> > if there are any that still need to get merged into linux-next though.
> >
> > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> > > index 768306add591..f4332981ea85 100644
> > > --- a/scripts/Makefile.extrawarn
> > > +++ b/scripts/Makefile.extrawarn
> > > @@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
> > >  KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
> > >  KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
> > >  KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
> > > +KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
> > >  endif
> > >  endif
> >
> > This doesn't look right. Shouldn't you remove the line that turns off
> > -Wuninitilized
> > instead of adding only -Wsometimes-uninitialized?
>
> Well, there are still some outstanding issues with -Wuninitialized
> right? Like with DECLARE_WAIT_QUEUE_HEAD_ONSTACK? I'd rather not
> add warnings to the build but if you feel strongly, we could turn it on
> then fix them after.

Ah, I thought they were all fixed, as I don't see any remaining warnings
in my tree. It seems that I never send this workaround for
DECLARE_WAIT_QUEUE_HEAD_ONSTACK:

diff --git a/include/linux/wait.h b/include/linux/wait.h
index 5f3efabc36f4..cbe1ea0fce84 100644
--- a/include/linux/wait.h
+++ b/include/linux/wait.h
@@ -68,8 +68,15 @@ extern void __init_waitqueue_head(struct
wait_queue_head *wq_head, const char *n
        } 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

Are there any others you see?

      Arnd

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

* Re: [PATCH] kbuild: Enable -Wsometimes-uninitialized
  2019-04-30  9:46     ` Arnd Bergmann
@ 2019-04-30 20:54       ` Nathan Chancellor
  2019-05-01 12:30         ` Masahiro Yamada
  2019-05-23  1:50       ` Nathan Chancellor
  1 sibling, 1 reply; 7+ messages in thread
From: Nathan Chancellor @ 2019-04-30 20:54 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux, Nick Desaulniers

On Tue, Apr 30, 2019 at 11:46:44AM +0200, Arnd Bergmann wrote:
> On Tue, Apr 30, 2019 at 11:33 AM Nathan Chancellor
> <natechancellor@gmail.com> wrote:
> > On Tue, Apr 30, 2019 at 09:16:50AM +0200, Arnd Bergmann wrote:
> > > On Tue, Apr 30, 2019 at 3:01 AM Nathan Chancellor
> > > <natechancellor@gmail.com> wrote:
> > > >
> > > > This is Clang's version of GCC's -Wmaybe-uninitialized. Up to this
> > > > point, it has not been used because -Wuninitialized has been disabled,
> > > > which also turns off -Wsometimes-uninitialized, meaning that we miss out
> > > > on finding some bugs [1]. In my experience, it appears to be more
> > > > accurate than GCC and catch some things that GCC can't.
> > > >
> > > > All of these warnings have now been fixed in -next across arm, arm64,
> > > > and x86_64 defconfig/allyesconfig so this should be enabled for everyone
> > > > to prevent more from easily creeping in.
> > > >
> > > > As of next-20190429:
> > > >
> > > > $ git log --oneline --grep="sometimes-uninitialized" | wc -l
> > > > 45
> > > >
> > > > [1]: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/
> > > >
> > > > Link: https://github.com/ClangBuiltLinux/linux/issues/381
> > > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > > ---
> > > >
> > > > Masahiro, I am not sure how you want to handle merging this with regards
> > > > to all of the patches floating around in -next but I wanted to send this
> > > > out to let everyone know this is ready to be turned on.
> > > >
> > > > Arnd, are there many remaning -Wsometimes-uninitialized warnings in
> > > > randconfigs?
> > >
> > > No, I don't see any with the patches that I submitted. I haven't checked
> > > if there are any that still need to get merged into linux-next though.
> > >
> > > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> > > > index 768306add591..f4332981ea85 100644
> > > > --- a/scripts/Makefile.extrawarn
> > > > +++ b/scripts/Makefile.extrawarn
> > > > @@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
> > > >  KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
> > > >  KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
> > > >  KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
> > > > +KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
> > > >  endif
> > > >  endif
> > >
> > > This doesn't look right. Shouldn't you remove the line that turns off
> > > -Wuninitilized
> > > instead of adding only -Wsometimes-uninitialized?
> >
> > Well, there are still some outstanding issues with -Wuninitialized
> > right? Like with DECLARE_WAIT_QUEUE_HEAD_ONSTACK? I'd rather not
> > add warnings to the build but if you feel strongly, we could turn it on
> > then fix them after.
> 
> Ah, I thought they were all fixed, as I don't see any remaining warnings
> in my tree. It seems that I never send this workaround for
> DECLARE_WAIT_QUEUE_HEAD_ONSTACK:
> 
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index 5f3efabc36f4..cbe1ea0fce84 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -68,8 +68,15 @@ extern void __init_waitqueue_head(struct
> wait_queue_head *wq_head, const char *n
>         } 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
> 
> Are there any others you see?
> 
>       Arnd

After applying that diff by hand and another patch that was accepted but
not in -next (https://lore.kernel.org/lkml/20190325125147.1436083-1-arnd@arndb.de/),
I see three other warnings:

arm, arm64, and x86_64 allyesconfig:

drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: error: variable 'data'
is uninitialized when used here [-Werror,-Wuninitialized]

https://github.com/ClangBuiltLinux/linux/issues/464

x86 allyesconfig:

mm/kasan/common.c:490:40: error: variable 'tag' is uninitialized when
used here [-Werror,-Wuninitialized]

https://github.com/ClangBuiltLinux/linux/issues/465

drivers/misc/sgi-xp/xpc_partition.c:73:14: error: variable 'buf' is
uninitialized when used within its own initialization
[-Werror,-Wuninitialized]

https://github.com/ClangBuiltLinux/linux/issues/466

These shouldn't be difficult to fix then we can turn both uninitialized
warnings.

Please let me know if you have any input with regards to fixing them, I
am going to try to look at them later today.

Nathan

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

* Re: [PATCH] kbuild: Enable -Wsometimes-uninitialized
  2019-04-30 20:54       ` Nathan Chancellor
@ 2019-05-01 12:30         ` Masahiro Yamada
  0 siblings, 0 replies; 7+ messages in thread
From: Masahiro Yamada @ 2019-05-01 12:30 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Arnd Bergmann, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux, Nick Desaulniers

On Wed, May 1, 2019 at 5:54 AM Nathan Chancellor
<natechancellor@gmail.com> wrote:
>
> On Tue, Apr 30, 2019 at 11:46:44AM +0200, Arnd Bergmann wrote:
> > On Tue, Apr 30, 2019 at 11:33 AM Nathan Chancellor
> > <natechancellor@gmail.com> wrote:
> > > On Tue, Apr 30, 2019 at 09:16:50AM +0200, Arnd Bergmann wrote:
> > > > On Tue, Apr 30, 2019 at 3:01 AM Nathan Chancellor
> > > > <natechancellor@gmail.com> wrote:
> > > > >
> > > > > This is Clang's version of GCC's -Wmaybe-uninitialized. Up to this
> > > > > point, it has not been used because -Wuninitialized has been disabled,
> > > > > which also turns off -Wsometimes-uninitialized, meaning that we miss out
> > > > > on finding some bugs [1]. In my experience, it appears to be more
> > > > > accurate than GCC and catch some things that GCC can't.
> > > > >
> > > > > All of these warnings have now been fixed in -next across arm, arm64,
> > > > > and x86_64 defconfig/allyesconfig so this should be enabled for everyone
> > > > > to prevent more from easily creeping in.
> > > > >
> > > > > As of next-20190429:
> > > > >
> > > > > $ git log --oneline --grep="sometimes-uninitialized" | wc -l
> > > > > 45
> > > > >
> > > > > [1]: https://lore.kernel.org/lkml/86649ee4-9794-77a3-502c-f4cd10019c36@lca.pw/
> > > > >
> > > > > Link: https://github.com/ClangBuiltLinux/linux/issues/381
> > > > > Signed-off-by: Nathan Chancellor <natechancellor@gmail.com>
> > > > > ---
> > > > >
> > > > > Masahiro, I am not sure how you want to handle merging this with regards
> > > > > to all of the patches floating around in -next but I wanted to send this
> > > > > out to let everyone know this is ready to be turned on.
> > > > >
> > > > > Arnd, are there many remaning -Wsometimes-uninitialized warnings in
> > > > > randconfigs?
> > > >
> > > > No, I don't see any with the patches that I submitted. I haven't checked
> > > > if there are any that still need to get merged into linux-next though.
> > > >
> > > > > diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn
> > > > > index 768306add591..f4332981ea85 100644
> > > > > --- a/scripts/Makefile.extrawarn
> > > > > +++ b/scripts/Makefile.extrawarn
> > > > > @@ -72,5 +72,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, format)
> > > > >  KBUILD_CFLAGS += $(call cc-disable-warning, sign-compare)
> > > > >  KBUILD_CFLAGS += $(call cc-disable-warning, format-zero-length)
> > > > >  KBUILD_CFLAGS += $(call cc-disable-warning, uninitialized)
> > > > > +KBUILD_CFLAGS += $(call cc-option, -Wsometimes-uninitialized)
> > > > >  endif
> > > > >  endif
> > > >
> > > > This doesn't look right. Shouldn't you remove the line that turns off
> > > > -Wuninitilized
> > > > instead of adding only -Wsometimes-uninitialized?
> > >
> > > Well, there are still some outstanding issues with -Wuninitialized
> > > right? Like with DECLARE_WAIT_QUEUE_HEAD_ONSTACK? I'd rather not
> > > add warnings to the build but if you feel strongly, we could turn it on
> > > then fix them after.
> >
> > Ah, I thought they were all fixed, as I don't see any remaining warnings
> > in my tree. It seems that I never send this workaround for
> > DECLARE_WAIT_QUEUE_HEAD_ONSTACK:
> >
> > diff --git a/include/linux/wait.h b/include/linux/wait.h
> > index 5f3efabc36f4..cbe1ea0fce84 100644
> > --- a/include/linux/wait.h
> > +++ b/include/linux/wait.h
> > @@ -68,8 +68,15 @@ extern void __init_waitqueue_head(struct
> > wait_queue_head *wq_head, const char *n
> >         } 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
> >
> > Are there any others you see?
> >
> >       Arnd
>
> After applying that diff by hand and another patch that was accepted but
> not in -next (https://lore.kernel.org/lkml/20190325125147.1436083-1-arnd@arndb.de/),
> I see three other warnings:
>
> arm, arm64, and x86_64 allyesconfig:
>
> drivers/net/wireless/rsi/rsi_91x_sdio.c:940:43: error: variable 'data'
> is uninitialized when used here [-Werror,-Wuninitialized]
>
> https://github.com/ClangBuiltLinux/linux/issues/464
>
> x86 allyesconfig:
>
> mm/kasan/common.c:490:40: error: variable 'tag' is uninitialized when
> used here [-Werror,-Wuninitialized]
>
> https://github.com/ClangBuiltLinux/linux/issues/465
>
> drivers/misc/sgi-xp/xpc_partition.c:73:14: error: variable 'buf' is
> uninitialized when used within its own initialization
> [-Werror,-Wuninitialized]
>
> https://github.com/ClangBuiltLinux/linux/issues/466
>
> These shouldn't be difficult to fix then we can turn both uninitialized
> warnings.
>
> Please let me know if you have any input with regards to fixing them, I
> am going to try to look at them later today.
>
> Nathan


I will postpone this patch.


It looks like we agreed to fix warnings first,
then remove $(call cc-disable-warning, uninitialized).





-- 
Best Regards
Masahiro Yamada

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

* Re: [PATCH] kbuild: Enable -Wsometimes-uninitialized
  2019-04-30  9:46     ` Arnd Bergmann
  2019-04-30 20:54       ` Nathan Chancellor
@ 2019-05-23  1:50       ` Nathan Chancellor
  1 sibling, 0 replies; 7+ messages in thread
From: Nathan Chancellor @ 2019-05-23  1:50 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Masahiro Yamada, Michal Marek, Linux Kbuild mailing list,
	Linux Kernel Mailing List, clang-built-linux, Nick Desaulniers

On Tue, Apr 30, 2019 at 11:46:44AM +0200, Arnd Bergmann wrote:
> Ah, I thought they were all fixed, as I don't see any remaining warnings
> in my tree. It seems that I never send this workaround for
> DECLARE_WAIT_QUEUE_HEAD_ONSTACK:
> 
> diff --git a/include/linux/wait.h b/include/linux/wait.h
> index 5f3efabc36f4..cbe1ea0fce84 100644
> --- a/include/linux/wait.h
> +++ b/include/linux/wait.h
> @@ -68,8 +68,15 @@ extern void __init_waitqueue_head(struct
> wait_queue_head *wq_head, const char *n
>         } 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
> 
> Are there any others you see?
> 
>       Arnd

Hi Arnd,

Were you planning on sending this out for review? It would be nice to
get these fixed so we can get this warning enabled.

I am bumping the other patches/inquiries I have sent now.

Cheers,
Nathan

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

end of thread, other threads:[~2019-05-23  1:50 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-30  1:00 [PATCH] kbuild: Enable -Wsometimes-uninitialized Nathan Chancellor
2019-04-30  7:16 ` Arnd Bergmann
2019-04-30  9:33   ` Nathan Chancellor
2019-04-30  9:46     ` Arnd Bergmann
2019-04-30 20:54       ` Nathan Chancellor
2019-05-01 12:30         ` Masahiro Yamada
2019-05-23  1:50       ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).