1. 02 3月, 2022 1 次提交
  2. 01 3月, 2022 2 次提交
  3. 23 2月, 2022 2 次提交
  4. 18 2月, 2022 3 次提交
  5. 16 2月, 2022 1 次提交
  6. 12 2月, 2022 1 次提交
  7. 09 2月, 2022 2 次提交
  8. 08 2月, 2022 1 次提交
  9. 07 2月, 2022 2 次提交
  10. 06 2月, 2022 1 次提交
  11. 03 2月, 2022 5 次提交
  12. 02 2月, 2022 3 次提交
    • H
      fbcon: Add option to enable legacy hardware acceleration · a3f781a9
      Helge Deller 提交于
      Add a config option CONFIG_FRAMEBUFFER_CONSOLE_LEGACY_ACCELERATION to
      enable bitblt and fillrect hardware acceleration in the framebuffer
      console. If disabled, such acceleration will not be used, even if it is
      supported by the graphics hardware driver.
      
      If you plan to use DRM as your main graphics output system, you should
      disable this option since it will prevent compiling in code which isn't
      used later on when DRM takes over.
      
      For all other configurations, e.g. if none of your graphic cards support
      DRM (yet), DRM isn't available for your architecture, or you can't be
      sure that the graphic card in the target system will support DRM, you
      most likely want to enable this option.
      
      In the non-accelerated case (e.g. when DRM is used), the inlined
      fb_scrollmode() function is hardcoded to return SCROLL_REDRAW and as such the
      compiler is able to optimize much unneccesary code away.
      
      In this v3 patch version I additionally changed the GETVYRES() and GETVXRES()
      macros to take a pointer to the fbcon_display struct. This fixes the build when
      console rotation is enabled and helps the compiler again to optimize out code.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Cc: stable@vger.kernel.org # v5.10+
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220202135531.92183-4-deller@gmx.de
      a3f781a9
    • H
      Revert "fbcon: Disable accelerated scrolling" · 87ab9f6b
      Helge Deller 提交于
      This reverts commit 39aead83.
      
      Revert the first (of 2) commits which disabled scrolling acceleration in
      fbcon/fbdev.  It introduced a regression for fbdev-supported graphic cards
      because of the performance penalty by doing screen scrolling by software
      instead of using the existing graphic card 2D hardware acceleration.
      
      Console scrolling acceleration was disabled by dropping code which
      checked at runtime the driver hardware capabilities for the
      BINFO_HWACCEL_COPYAREA or FBINFO_HWACCEL_FILLRECT flags and if set, it
      enabled scrollmode SCROLL_MOVE which uses hardware acceleration to move
      screen contents.  After dropping those checks scrollmode was hard-wired
      to SCROLL_REDRAW instead, which forces all graphic cards to redraw every
      character at the new screen position when scrolling.
      
      This change effectively disabled all hardware-based scrolling acceleration for
      ALL drivers, because now all kind of 2D hardware acceleration (bitblt,
      fillrect) in the drivers isn't used any longer.
      
      The original commit message mentions that only 3 DRM drivers (nouveau, omapdrm
      and gma500) used hardware acceleration in the past and thus code for checking
      and using scrolling acceleration is obsolete.
      
      This statement is NOT TRUE, because beside the DRM drivers there are around 35
      other fbdev drivers which depend on fbdev/fbcon and still provide hardware
      acceleration for fbdev/fbcon.
      
      The original commit message also states that syzbot found lots of bugs in fbcon
      and thus it's "often the solution to just delete code and remove features".
      This is true, and the bugs - which actually affected all users of fbcon,
      including DRM - were fixed, or code was dropped like e.g. the support for
      software scrollback in vgacon (commit 973c096f).
      
      So to further analyze which bugs were found by syzbot, I've looked through all
      patches in drivers/video which were tagged with syzbot or syzkaller back to
      year 2005. The vast majority fixed the reported issues on a higher level, e.g.
      when screen is to be resized, or when font size is to be changed. The few ones
      which touched driver code fixed a real driver bug, e.g. by adding a check.
      
      But NONE of those patches touched code of either the SCROLL_MOVE or the
      SCROLL_REDRAW case.
      
      That means, there was no real reason why SCROLL_MOVE had to be ripped-out and
      just SCROLL_REDRAW had to be used instead. The only reason I can imagine so far
      was that SCROLL_MOVE wasn't used by DRM and as such it was assumed that it
      could go away. That argument completely missed the fact that SCROLL_MOVE is
      still heavily used by fbdev (non-DRM) drivers.
      
      Some people mention that using memcpy() instead of the hardware acceleration is
      pretty much the same speed. But that's not true, at least not for older graphic
      cards and machines where we see speed decreases by factor 10 and more and thus
      this change leads to console responsiveness way worse than before.
      
      That's why the original commit is to be reverted. By reverting we
      reintroduce hardware-based scrolling acceleration and fix the
      performance regression for fbdev drivers.
      
      There isn't any impact on DRM when reverting those patches.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NSven Schnelle <svens@stackframe.org>
      Cc: stable@vger.kernel.org # v5.10+
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220202135531.92183-3-deller@gmx.de
      87ab9f6b
    • H
      Revert "fbdev: Garbage collect fbdev scrolling acceleration, part 1 (from TODO list)" · 1148836f
      Helge Deller 提交于
      This reverts commit b3ec8cdf.
      
      Revert the second (of 2) commits which disabled scrolling acceleration
      in fbcon/fbdev.  It introduced a regression for fbdev-supported graphic
      cards because of the performance penalty by doing screen scrolling by
      software instead of using the existing graphic card 2D hardware
      acceleration.
      
      Console scrolling acceleration was disabled by dropping code which
      checked at runtime the driver hardware capabilities for the
      BINFO_HWACCEL_COPYAREA or FBINFO_HWACCEL_FILLRECT flags and if set, it
      enabled scrollmode SCROLL_MOVE which uses hardware acceleration to move
      screen contents.  After dropping those checks scrollmode was hard-wired
      to SCROLL_REDRAW instead, which forces all graphic cards to redraw every
      character at the new screen position when scrolling.
      
      This change effectively disabled all hardware-based scrolling acceleration for
      ALL drivers, because now all kind of 2D hardware acceleration (bitblt,
      fillrect) in the drivers isn't used any longer.
      
      The original commit message mentions that only 3 DRM drivers (nouveau, omapdrm
      and gma500) used hardware acceleration in the past and thus code for checking
      and using scrolling acceleration is obsolete.
      
      This statement is NOT TRUE, because beside the DRM drivers there are around 35
      other fbdev drivers which depend on fbdev/fbcon and still provide hardware
      acceleration for fbdev/fbcon.
      
      The original commit message also states that syzbot found lots of bugs in fbcon
      and thus it's "often the solution to just delete code and remove features".
      This is true, and the bugs - which actually affected all users of fbcon,
      including DRM - were fixed, or code was dropped like e.g. the support for
      software scrollback in vgacon (commit 973c096f).
      
      So to further analyze which bugs were found by syzbot, I've looked through all
      patches in drivers/video which were tagged with syzbot or syzkaller back to
      year 2005. The vast majority fixed the reported issues on a higher level, e.g.
      when screen is to be resized, or when font size is to be changed. The few ones
      which touched driver code fixed a real driver bug, e.g. by adding a check.
      
      But NONE of those patches touched code of either the SCROLL_MOVE or the
      SCROLL_REDRAW case.
      
      That means, there was no real reason why SCROLL_MOVE had to be ripped-out and
      just SCROLL_REDRAW had to be used instead. The only reason I can imagine so far
      was that SCROLL_MOVE wasn't used by DRM and as such it was assumed that it
      could go away. That argument completely missed the fact that SCROLL_MOVE is
      still heavily used by fbdev (non-DRM) drivers.
      
      Some people mention that using memcpy() instead of the hardware acceleration is
      pretty much the same speed. But that's not true, at least not for older graphic
      cards and machines where we see speed decreases by factor 10 and more and thus
      this change leads to console responsiveness way worse than before.
      
      That's why the original commit is to be reverted. By reverting we
      reintroduce hardware-based scrolling acceleration and fix the
      performance regression for fbdev drivers.
      
      There isn't any impact on DRM when reverting those patches.
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Acked-by: NGeert Uytterhoeven <geert@linux-m68k.org>
      Acked-by: NSven Schnelle <svens@stackframe.org>
      Cc: stable@vger.kernel.org # v5.16+
      Signed-off-by: NHelge Deller <deller@gmx.de>
      Signed-off-by: NDaniel Vetter <daniel.vetter@ffwll.ch>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220202135531.92183-2-deller@gmx.de
      1148836f
  13. 01 2月, 2022 2 次提交
  14. 28 1月, 2022 1 次提交
    • A
      drm/kmb: Fix for build errors with Warray-bounds · 43f25179
      Anitha Chrisanthus 提交于
      This fixes the following build error
      
      drivers/gpu/drm/kmb/kmb_plane.c: In function 'kmb_plane_atomic_disable':
      drivers/gpu/drm/kmb/kmb_plane.c:165:34: error: array subscript 3 is above array bounds of 'struct layer_status[2]' [-Werror=array-bounds]
        165 |                 kmb->plane_status[plane_id].ctrl =
        LCD_CTRL_GL2_ENABLE;
        |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~
        In file included from drivers/gpu/drm/kmb/kmb_plane.c:17:
        drivers/gpu/drm/kmb/kmb_drv.h:61:41: note: while referencing 'plane_status'
        61 |         struct layer_status  plane_status[KMB_MAX_PLANES];
        |                                         ^~~~~~~~~~~~
        drivers/gpu/drm/kmb/kmb_plane.c:162:34: error: array subscript 2 is above array bounds of 'struct layer_status[2]' [-Werror=array-bounds]
        162 |  kmb->plane_status[plane_id].ctrl =  LCD_CTRL_GL1_ENABLE;
        |                 ~~~~~~~~~~~~~~~~~^~~~~~~~~~
        In file included from
        drivers/gpu/drm/kmb/kmb_plane.c:17:
        drivers/gpu/drm/kmb/kmb_drv.h:61:41: note: while referencing 'plane_status'
        61 |         struct layer_status  plane_status[KMB_MAX_PLANES];
        |
        ^~~~~~~~~~~~
      
      Fixes: 7f7b96a8 ("drm/kmb: Add support for KeemBay Display")
      Signed-off-by: NAnitha Chrisanthus <anitha.chrisanthus@intel.com>
      Reviewed-by: NKees Cook <keescook@chromium.org>
      Link: https://patchwork.freedesktop.org/patch/msgid/20220127194227.2213608-1-anitha.chrisanthus@intel.com
      43f25179
  15. 26 1月, 2022 2 次提交
  16. 25 1月, 2022 1 次提交
  17. 22 1月, 2022 10 次提交
    • V
      lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() · 2dba5eb1
      Vlastimil Babka 提交于
      Currently, enabling CONFIG_STACKDEPOT means its stack_table will be
      allocated from memblock, even if stack depot ends up not actually used.
      The default size of stack_table is 4MB on 32-bit, 8MB on 64-bit.
      
      This is fine for use-cases such as KASAN which is also a config option
      and has overhead on its own.  But it's an issue for functionality that
      has to be actually enabled on boot (page_owner) or depends on hardware
      (GPU drivers) and thus the memory might be wasted.  This was raised as
      an issue [1] when attempting to add stackdepot support for SLUB's debug
      object tracking functionality.  It's common to build kernels with
      CONFIG_SLUB_DEBUG and enable slub_debug on boot only when needed, or
      create only specific kmem caches with debugging for testing purposes.
      
      It would thus be more efficient if stackdepot's table was allocated only
      when actually going to be used.  This patch thus makes the allocation
      (and whole stack_depot_init() call) optional:
      
       - Add a CONFIG_STACKDEPOT_ALWAYS_INIT flag to keep using the current
         well-defined point of allocation as part of mem_init(). Make
         CONFIG_KASAN select this flag.
      
       - Other users have to call stack_depot_init() as part of their own init
         when it's determined that stack depot will actually be used. This may
         depend on both config and runtime conditions. Convert current users
         which are page_owner and several in the DRM subsystem. Same will be
         done for SLUB later.
      
       - Because the init might now be called after the boot-time memblock
         allocation has given all memory to the buddy allocator, change
         stack_depot_init() to allocate stack_table with kvmalloc() when
         memblock is no longer available. Also handle allocation failure by
         disabling stackdepot (could have theoretically happened even with
         memblock allocation previously), and don't unnecessarily align the
         memblock allocation to its own size anymore.
      
      [1] https://lore.kernel.org/all/CAMuHMdW=eoVzM1Re5FVoEN87nKfiLmM2+Ah7eNu2KXEhCvbZyA@mail.gmail.com/
      
      Link: https://lkml.kernel.org/r/20211013073005.11351-1-vbabka@suse.czSigned-off-by: NVlastimil Babka <vbabka@suse.cz>
      Acked-by: NDmitry Vyukov <dvyukov@google.com>
      Reviewed-by: Marco Elver <elver@google.com> # stackdepot
      Cc: Marco Elver <elver@google.com>
      Cc: Vijayanand Jitta <vjitta@codeaurora.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Oliver Glitta <glittao@gmail.com>
      Cc: Imran Khan <imran.f.khan@oracle.com>
      From: Colin Ian King <colin.king@canonical.com>
      Subject: lib/stackdepot: fix spelling mistake and grammar in pr_err message
      
      There is a spelling mistake of the work allocation so fix this and
      re-phrase the message to make it easier to read.
      
      Link: https://lkml.kernel.org/r/20211015104159.11282-1-colin.king@canonical.comSigned-off-by: NColin Ian King <colin.king@canonical.com>
      Cc: Vlastimil Babka <vbabka@suse.cz>
      From: Vlastimil Babka <vbabka@suse.cz>
      Subject: lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() - fixup
      
      On FLATMEM, we call page_ext_init_flatmem_late() just before
      kmem_cache_init() which means stack_depot_init() (called by page owner
      init) will not recognize properly it should use kvmalloc() and not
      memblock_alloc().  memblock_alloc() will also not issue a warning and
      return a block memory that can be invalid and cause kernel page fault when
      saving stacks, as reported by the kernel test robot [1].
      
      Fix this by moving page_ext_init_flatmem_late() below kmem_cache_init() so
      that slab_is_available() is true during stack_depot_init().  SPARSEMEM
      doesn't have this issue, as it doesn't do page_ext_init_flatmem_late(),
      but a different page_ext_init() even later in the boot process.
      
      Thanks to Mike Rapoport for pointing out the FLATMEM init ordering issue.
      
      While at it, also actually resolve a checkpatch warning in stack_depot_init()
      from DRM CI, which was supposed to be in the original patch already.
      
      [1] https://lore.kernel.org/all/20211014085450.GC18719@xsang-OptiPlex-9020/
      
      Link: https://lkml.kernel.org/r/6abd9213-19a9-6d58-cedc-2414386d2d81@suse.czSigned-off-by: NVlastimil Babka <vbabka@suse.cz>
      Reported-by: Nkernel test robot <oliver.sang@intel.com>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      From: Vlastimil Babka <vbabka@suse.cz>
      Subject: lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() - fixup3
      
      Due to cd06ab2f ("drm/locking: add backtrace for locking contended
      locks without backoff") landing recently to -next adding a new stack depot
      user in drivers/gpu/drm/drm_modeset_lock.c we need to add an appropriate
      call to stack_depot_init() there as well.
      
      Link: https://lkml.kernel.org/r/2a692365-cfa1-64f2-34e0-8aa5674dce5e@suse.czSigned-off-by: NVlastimil Babka <vbabka@suse.cz>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
      Cc: Marco Elver <elver@google.com>
      Cc: Vijayanand Jitta <vjitta@codeaurora.org>
      Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
      Cc: Maxime Ripard <mripard@kernel.org>
      Cc: Thomas Zimmermann <tzimmermann@suse.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Daniel Vetter <daniel@ffwll.ch>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Oliver Glitta <glittao@gmail.com>
      Cc: Imran Khan <imran.f.khan@oracle.com>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      From: Vlastimil Babka <vbabka@suse.cz>
      Subject: lib/stackdepot: allow optional init and stack_table allocation by kvmalloc() - fixup4
      
      Due to 4e66934e ("lib: add reference counting tracking
      infrastructure") landing recently to net-next adding a new stack depot
      user in lib/ref_tracker.c we need to add an appropriate call to
      stack_depot_init() there as well.
      
      Link: https://lkml.kernel.org/r/45c1b738-1a2f-5b5f-2f6d-86fab206d01c@suse.czSigned-off-by: NVlastimil Babka <vbabka@suse.cz>
      Reviewed-by: NEric Dumazet <edumazet@google.com>
      Cc: Jiri Slab <jirislaby@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      2dba5eb1
    • M
      proc: remove PDE_DATA() completely · 359745d7
      Muchun Song 提交于
      Remove PDE_DATA() completely and replace it with pde_data().
      
      [akpm@linux-foundation.org: fix naming clash in drivers/nubus/proc.c]
      [akpm@linux-foundation.org: now fix it properly]
      
      Link: https://lkml.kernel.org/r/20211124081956.87711-2-songmuchun@bytedance.comSigned-off-by: NMuchun Song <songmuchun@bytedance.com>
      Acked-by: NChristian Brauner <christian.brauner@ubuntu.com>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Alexey Gladkov <gladkov.alexey@gmail.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      359745d7
    • X
      scsi/sg: move sg-big-buff sysctl to scsi/sg.c · 26d1c80f
      Xiaoming Ni 提交于
      kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
      dishes, this makes it very difficult to maintain.
      
      To help with this maintenance let's start by moving sysctls to places
      where they actually belong.  The proc sysctl maintainers do not want to
      know what sysctl knobs you wish to add for your own piece of code, we
      just care about the core logic.
      
      So move the sg-big-buff sysctl from kernel/sysctl.c to drivers/scsi/sg.c
      and use register_sysctl() to register the sysctl interface.
      
      [mcgrof@kernel.org: commit log update]
      
      Link: https://lkml.kernel.org/r/20211124231435.1445213-7-mcgrof@kernel.orgSigned-off-by: NXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      26d1c80f
    • X
      random: move the random sysctl declarations to its own file · 5475e8f0
      Xiaoming Ni 提交于
      kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
      dishes, this makes it very difficult to maintain.
      
      To help with this maintenance let's start by moving sysctls to places
      where they actually belong.  The proc sysctl maintainers do not want to
      know what sysctl knobs you wish to add for your own piece of code, we
      just care about the core logic.
      
      So move the random sysctls to their own file and use
      register_sysctl_init().
      
      [mcgrof@kernel.org: commit log update to justify the move]
      
      Link: https://lkml.kernel.org/r/20211124231435.1445213-3-mcgrof@kernel.orgSigned-off-by: NXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      5475e8f0
    • X
      firmware_loader: move firmware sysctl to its own files · 6aad36d4
      Xiaoming Ni 提交于
      Patch series "sysctl: 3rd set of kernel/sysctl cleanups", v2.
      
      This is the third set of patches to help address cleaning the kitchen
      seink in kernel/sysctl.c and to move sysctls away to where they are
      actually implemented / used.
      
      This patch (of 8):
      
      kernel/sysctl.c is a kitchen sink where everyone leaves their dirty
      dishes, this makes it very difficult to maintain.
      
      To help with this maintenance let's start by moving sysctls to places
      where they actually belong.  The proc sysctl maintainers do not want to
      know what sysctl knobs you wish to add for your own piece of code, we
      just care about the core logic.
      
      So move the firmware configuration sysctl table to the only place where
      it is used, and make it clear that if sysctls are disabled this is not
      used.
      
      [akpm@linux-foundation.org: export register_firmware_config_sysctl and unregister_firmware_config_sysctl to modules]
      [akpm@linux-foundation.org: use EXPORT_SYMBOL_NS_GPL instead]
      [sfr@canb.auug.org.au: fix that so it compiles]
        Link: https://lkml.kernel.org/r/20211201160626.401d828d@canb.auug.org.au
      [mcgrof@kernel.org: major commit log update to justify the move]
      
      Link: https://lkml.kernel.org/r/20211124231435.1445213-1-mcgrof@kernel.org
      Link: https://lkml.kernel.org/r/20211124231435.1445213-2-mcgrof@kernel.orgSigned-off-by: NXiaoming Ni <nixiaoming@huawei.com>
      Signed-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Signed-off-by: NStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      6aad36d4
    • L
      cdrom: simplify subdirectory registration with register_sysctl() · ad8f7431
      Luis Chamberlain 提交于
      There is no need to user boiler plate code to specify a set of base
      directories we're going to stuff sysctls under.  Simplify this by using
      register_sysctl() and specifying the directory path directly.
      
      // pycocci sysctl-subdir-register-sysctl-simplify.cocci PATH
      
      @c1@
      expression E1;
      identifier subdir, sysctls;
      @@
      
      static struct ctl_table subdir[] = {
      	{
      		.procname = E1,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = sysctls,
      	},
      	{ }
      };
      
      @c2@
      identifier c1.subdir;
      
      expression E2;
      identifier base;
      @@
      
      static struct ctl_table base[] = {
      	{
      		.procname = E2,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = subdir,
      	},
      	{ }
      };
      
      @c3@
      identifier c2.base;
      identifier header;
      @@
      
      header = register_sysctl_table(base);
      
      @r1 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.subdir, c1.sysctls;
      @@
      
      -static struct ctl_table subdir[] = {
      -	{
      -		.procname = E1,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = sysctls,
      -	},
      -	{ }
      -};
      
      @r2 depends on c1 && c2 && c3@
      identifier c1.subdir;
      
      expression c2.E2;
      identifier c2.base;
      @@
      -static struct ctl_table base[] = {
      -	{
      -		.procname = E2,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = subdir,
      -	},
      -	{ }
      -};
      
      @initialize:python@
      @@
      
      def make_my_fresh_expression(s1, s2):
        return '"' + s1.strip('"') + "/" + s2.strip('"') + '"'
      
      @r3 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.sysctls;
      expression c2.E2;
      identifier c2.base;
      identifier c3.header;
      fresh identifier E3 = script:python(E2, E1) { make_my_fresh_expression(E2, E1) };
      @@
      
      header =
      -register_sysctl_table(base);
      +register_sysctl(E3, sysctls);
      
      Generated-by: Coccinelle SmPL
      Link: https://lkml.kernel.org/r/20211123202422.819032-8-mcgrof@kernel.orgSigned-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Xiaoming Ni <nixiaoming@huawei.com>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      ad8f7431
    • L
      macintosh/mac_hid.c: simplify subdirectory registration with register_sysctl() · e99f5e74
      Luis Chamberlain 提交于
      There is no need to user boiler plate code to specify a set of base
      directories we're going to stuff sysctls under.  Simplify this by using
      register_sysctl() and specifying the directory path directly.
      
      // pycocci sysctl-subdir-register-sysctl-simplify.cocci PATH
      
      @c1@
      expression E1;
      identifier subdir, sysctls;
      @@
      
      static struct ctl_table subdir[] = {
      	{
      		.procname = E1,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = sysctls,
      	},
      	{ }
      };
      
      @c2@
      identifier c1.subdir;
      
      expression E2;
      identifier base;
      @@
      
      static struct ctl_table base[] = {
      	{
      		.procname = E2,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = subdir,
      	},
      	{ }
      };
      
      @c3@
      identifier c2.base;
      identifier header;
      @@
      
      header = register_sysctl_table(base);
      
      @r1 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.subdir, c1.sysctls;
      @@
      
      -static struct ctl_table subdir[] = {
      -	{
      -		.procname = E1,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = sysctls,
      -	},
      -	{ }
      -};
      
      @r2 depends on c1 && c2 && c3@
      identifier c1.subdir;
      
      expression c2.E2;
      identifier c2.base;
      @@
      -static struct ctl_table base[] = {
      -	{
      -		.procname = E2,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = subdir,
      -	},
      -	{ }
      -};
      
      @initialize:python@
      @@
      
      def make_my_fresh_expression(s1, s2):
        return '"' + s1.strip('"') + "/" + s2.strip('"') + '"'
      
      @r3 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.sysctls;
      expression c2.E2;
      identifier c2.base;
      identifier c3.header;
      fresh identifier E3 = script:python(E2, E1) { make_my_fresh_expression(E2, E1) };
      @@
      
      header =
      -register_sysctl_table(base);
      +register_sysctl(E3, sysctls);
      
      Generated-by: Coccinelle SmPL
      Link: https://lkml.kernel.org/r/20211123202422.819032-4-mcgrof@kernel.orgSigned-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Xiaoming Ni <nixiaoming@huawei.com>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e99f5e74
    • L
      i915: simplify subdirectory registration with register_sysctl() · e5a1fd99
      Luis Chamberlain 提交于
      There is no need to user boiler plate code to specify a set of base
      directories we're going to stuff sysctls under.  Simplify this by using
      register_sysctl() and specifying the directory path directly.
      
      // pycocci sysctl-subdir-register-sysctl-simplify.cocci PATH
      
      @c1@
      expression E1;
      identifier subdir, sysctls;
      @@
      
      static struct ctl_table subdir[] = {
      	{
      		.procname = E1,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = sysctls,
      	},
      	{ }
      };
      
      @c2@
      identifier c1.subdir;
      
      expression E2;
      identifier base;
      @@
      
      static struct ctl_table base[] = {
      	{
      		.procname = E2,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = subdir,
      	},
      	{ }
      };
      
      @c3@
      identifier c2.base;
      identifier header;
      @@
      
      header = register_sysctl_table(base);
      
      @r1 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.subdir, c1.sysctls;
      @@
      
      -static struct ctl_table subdir[] = {
      -	{
      -		.procname = E1,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = sysctls,
      -	},
      -	{ }
      -};
      
      @r2 depends on c1 && c2 && c3@
      identifier c1.subdir;
      
      expression c2.E2;
      identifier c2.base;
      @@
      -static struct ctl_table base[] = {
      -	{
      -		.procname = E2,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = subdir,
      -	},
      -	{ }
      -};
      
      @initialize:python@
      @@
      
      def make_my_fresh_expression(s1, s2):
        return '"' + s1.strip('"') + "/" + s2.strip('"') + '"'
      
      @r3 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.sysctls;
      expression c2.E2;
      identifier c2.base;
      identifier c3.header;
      fresh identifier E3 = script:python(E2, E1) { make_my_fresh_expression(E2, E1) };
      @@
      
      header =
      -register_sysctl_table(base);
      +register_sysctl(E3, sysctls);
      
      Generated-by: Coccinelle SmPL
      Link: https://lkml.kernel.org/r/20211123202422.819032-3-mcgrof@kernel.orgSigned-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Acked-by: NJani Nikula <jani.nikula@intel.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: David Airlie <airlied@linux.ie>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Xiaoming Ni <nixiaoming@huawei.com>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      e5a1fd99
    • L
      hpet: simplify subdirectory registration with register_sysctl() · c8dd5541
      Luis Chamberlain 提交于
      Patch series "sysctl: second set of kernel/sysctl cleanups", v2.
      
      This is the 2nd set of kernel/sysctl.c cleanups.  The diff stat should
      reflect how this is a much better way to deal with theses.  Fortunately
      coccinelle can be used to ensure correctness for most of these and/or
      future merge conflicts.
      
      Note that since this is part of a larger effort to cleanup
      kernel/sysctl.c I think we have no other option but to go with merging
      these patches in either Andrew's tree or keep them staged in a separate
      tree and send a merge request later.  Otherwise kernel/sysctl.c will end
      up becoming a sore spot for the next merge window.
      
      This patch (of 8):
      
      There is no need to user boiler plate code to specify a set of base
      directories we're going to stuff sysctls under.  Simplify this by using
      register_sysctl() and specifying the directory path directly.
      
      // pycocci sysctl-subdir-register-sysctl-simplify.cocci drivers/char/hpet.c
      
      @c1@
      expression E1;
      identifier subdir, sysctls;
      @@
      
      static struct ctl_table subdir[] = {
      	{
      		.procname = E1,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = sysctls,
      	},
      	{ }
      };
      
      @c2@
      identifier c1.subdir;
      
      expression E2;
      identifier base;
      @@
      
      static struct ctl_table base[] = {
      	{
      		.procname = E2,
      		.maxlen = 0,
      		.mode = 0555,
      		.child = subdir,
      	},
      	{ }
      };
      
      @c3@
      identifier c2.base;
      identifier header;
      @@
      
      header = register_sysctl_table(base);
      
      @r1 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.subdir, c1.sysctls;
      @@
      
      -static struct ctl_table subdir[] = {
      -	{
      -		.procname = E1,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = sysctls,
      -	},
      -	{ }
      -};
      
      @r2 depends on c1 && c2 && c3@
      identifier c1.subdir;
      
      expression c2.E2;
      identifier c2.base;
      @@
      -static struct ctl_table base[] = {
      -	{
      -		.procname = E2,
      -		.maxlen = 0,
      -		.mode = 0555,
      -		.child = subdir,
      -	},
      -	{ }
      -};
      
      @initialize:python@
      @@
      
      def make_my_fresh_expression(s1, s2):
        return '"' + s1.strip('"') + "/" + s2.strip('"') + '"'
      
      @r3 depends on c1 && c2 && c3@
      expression c1.E1;
      identifier c1.sysctls;
      expression c2.E2;
      identifier c2.base;
      identifier c3.header;
      fresh identifier E3 = script:python(E2, E1) { make_my_fresh_expression(E2, E1) };
      @@
      
      header =
      -register_sysctl_table(base);
      +register_sysctl(E3, sysctls);
      
      Generated-by: Coccinelle SmPL
      
      Link: https://lkml.kernel.org/r/20211123202422.819032-1-mcgrof@kernel.org
      Link: https://lkml.kernel.org/r/20211123202422.819032-2-mcgrof@kernel.orgSigned-off-by: NLuis Chamberlain <mcgrof@kernel.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Iurii Zaikin <yzaikin@google.com>
      Cc: Xiaoming Ni <nixiaoming@huawei.com>
      Cc: "Eric W. Biederman" <ebiederm@xmission.com>
      Cc: Clemens Ladisch <clemens@ladisch.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Jani Nikula <jani.nikula@linux.intel.com>
      Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
      Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
      Cc: David Airlie <airlied@linux.ie>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Mark Fasheh <mark@fasheh.com>
      Cc: Joel Becker <jlbec@evilplan.org>
      Cc: Joseph Qi <joseph.qi@linux.alibaba.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Amir Goldstein <amir73il@gmail.com>
      Cc: Phillip Potter <phil@philpotter.co.uk>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Julia Lawall <julia.lawall@inria.fr>
      Cc: Lukas Middendorf <kernel@tuxforce.de>
      Cc: Antti Palosaari <crope@iki.fi>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Benjamin LaHaise <bcrl@kvack.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Qing Wang <wangqing@vivo.com>
      Cc: Sebastian Reichel <sre@kernel.org>
      Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Stephen Kitt <steve@sk2.org>
      Cc: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
      Cc: Douglas Gilbert <dgilbert@interlog.com>
      Cc: James E.J. Bottomley <jejb@linux.ibm.com>
      Cc: Jani Nikula <jani.nikula@intel.com>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Martin K. Petersen <martin.petersen@oracle.com>
      Cc: "Rafael J. Wysocki" <rafael@kernel.org>
      Cc: Steven Rostedt (VMware) <rostedt@goodmis.org>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: "Theodore Ts'o" <tytso@mit.edu>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      c8dd5541
    • M
      parisc: pdc_stable: Fix memory leak in pdcs_register_pathentries · d24846a4
      Miaoqian Lin 提交于
      kobject_init_and_add() takes reference even when it fails.
      According to the doc of kobject_init_and_add():
      
         If this function returns an error, kobject_put() must be called to
         properly clean up the memory associated with the object.
      
      Fix memory leak by calling kobject_put().
      
      Fixes: 73f368cf ("Kobject: change drivers/parisc/pdc_stable.c to use kobject_init_and_add")
      Signed-off-by: NMiaoqian Lin <linmq006@gmail.com>
      Signed-off-by: NHelge Deller <deller@gmx.de>
      d24846a4