All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/19] Enable -Wshadow=local for kernel/sched
@ 2022-03-02  4:34 Matthew Wilcox (Oracle)
  2022-03-02  4:34 ` [PATCH 01/19] wait: Parameterize the return variable to ___wait_event() Matthew Wilcox (Oracle)
                   ` (13 more replies)
  0 siblings, 14 replies; 22+ messages in thread
From: Matthew Wilcox (Oracle) @ 2022-03-02  4:34 UTC (permalink / raw)
  To: Kees Cook, Ingo Molnar, Peter Zijlstra, Juri Lelli,
	Vincent Guittot, Dietmar Eggemann, Steven Rostedt, Ben Segall,
	Mel Gorman, Daniel Bristot de Oliveira, Linus Torvalds
  Cc: Matthew Wilcox (Oracle), linux-kernel

I thought I'd choose one of the more core parts of the kernel to
demonstrate the value of -Wshadow.  It found two places where there are
shadowed variables that are at least confusing.  For all I know they're
buggy and my resolution of these warnings is wrong.

The first 12 patches just untangle the unclean uses of __ret in wait.h
& friends.  Then 4 patches to fix problems in headers that are noticed
by kernel/sched.  Two patches fix the two places in kernel/sched/
with shadowed variables and the final patch adds -Wshadow=local to
the Makefile.

I'm quite certain this patch series isn't going in as-is.  But maybe
it'll inspire some patches that can go in.

Matthew Wilcox (Oracle) (19):
  wait: Parameterize the return variable to ___wait_event()
  swait: Parameterize the return variable to __swait_event_timeout()
  swait: Parameterize the return variable to
    __swait_event_interruptible_timeout()
  swait: Parameterize the return variable to
    __swait_event_idle_timeout()
  wait: Parameterize the return variable to __wait_event_timeout()
  wait: Parameterize the return variable to
    __wait_event_freezable_timeout()
  wait: Parameterize the return variable to
    __wait_event_interruptible_timeout()
  wait: Parameterize the return variable to __wait_event_idle_timeout()
  wait: Parameterize the return variable to
    __wait_event_idle_exclusive_timeout()
  wait: Parameterize the return variable to
    __wait_event_killable_timeout()
  wait: Parameterize the return variable to
    __wait_event_lock_irq_timeout()
  wait_bit: Parameterize the return variable to
    __wait_var_event_timeout()
  Add UNIQUE_ID
  wait: Add a unique identifier to ___wait_event()
  x86: Use a unique identifier in __WARN_FLAGS()
  x86: Pass a unique identifier to __xchg_op()
  sched/rt: Rename a shadowed variable
  sched/topology: Rename the cpu parameter
  sched: Enable -Wshadow=local

 arch/x86/include/asm/bug.h     |   4 +-
 arch/x86/include/asm/cmpxchg.h |   6 +-
 include/linux/compiler.h       |   1 +
 include/linux/swait.h          |  24 ++--
 include/linux/wait.h           | 223 ++++++++++++++++-----------------
 include/linux/wait_bit.h       |   9 +-
 kernel/sched/Makefile          |   1 +
 kernel/sched/rt.c              |   4 +-
 kernel/sched/topology.c        |   6 +-
 9 files changed, 138 insertions(+), 140 deletions(-)

-- 
2.34.1


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

end of thread, other threads:[~2024-04-19 22:06 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-02  4:34 [PATCH 00/19] Enable -Wshadow=local for kernel/sched Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 01/19] wait: Parameterize the return variable to ___wait_event() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 02/19] swait: Parameterize the return variable to __swait_event_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 03/19] swait: Parameterize the return variable to __swait_event_interruptible_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 04/19] swait: Parameterize the return variable to __swait_event_idle_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 05/19] wait: Parameterize the return variable to __wait_event_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 06/19] wait: Parameterize the return variable to __wait_event_freezable_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 07/19] wait: Parameterize the return variable to __wait_event_interruptible_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 08/19] wait: Parameterize the return variable to __wait_event_idle_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 09/19] wait: Parameterize the return variable to __wait_event_idle_exclusive_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 10/19] wait: Parameterize the return variable to __wait_event_killable_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 11/19] wait: Parameterize the return variable to __wait_event_lock_irq_timeout() Matthew Wilcox (Oracle)
2022-03-02  4:34 ` [PATCH 12/19] wait_bit: Parameterize the return variable to __wait_var_event_timeout() Matthew Wilcox (Oracle)
2022-03-02 18:32 ` [PATCH 00/19] Enable -Wshadow=local for kernel/sched Kees Cook
2022-03-02 18:43   ` Matthew Wilcox
2022-03-02 19:18     ` Peter Zijlstra
2024-04-16 21:15 ` Kees Cook
2024-04-17  0:29   ` Linus Torvalds
2024-04-17  0:50     ` Linus Torvalds
2024-04-17  0:52     ` Matthew Wilcox
2024-04-17 11:23       ` Ingo Molnar
2024-04-19 22:06       ` Kees Cook

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.