1
0
Fork 0
alistair23-linux/drivers/gpu/drm
Matteo Croce eec4844fae proc/sysctl: add shared variables for range check
In the sysctl code the proc_dointvec_minmax() function is often used to
validate the user supplied value between an allowed range.  This
function uses the extra1 and extra2 members from struct ctl_table as
minimum and maximum allowed value.

On sysctl handler declaration, in every source file there are some
readonly variables containing just an integer which address is assigned
to the extra1 and extra2 members, so the sysctl range is enforced.

The special values 0, 1 and INT_MAX are very often used as range
boundary, leading duplication of variables like zero=0, one=1,
int_max=INT_MAX in different source files:

    $ git grep -E '\.extra[12].*&(zero|one|int_max)' |wc -l
    248

Add a const int array containing the most commonly used values, some
macros to refer more easily to the correct array member, and use them
instead of creating a local one for every object file.

This is the bloat-o-meter output comparing the old and new binary
compiled with the default Fedora config:

    # scripts/bloat-o-meter -d vmlinux.o.old vmlinux.o
    add/remove: 2/2 grow/shrink: 0/2 up/down: 24/-188 (-164)
    Data                                         old     new   delta
    sysctl_vals                                    -      12     +12
    __kstrtab_sysctl_vals                          -      12     +12
    max                                           14      10      -4
    int_max                                       16       -     -16
    one                                           68       -     -68
    zero                                         128      28    -100
    Total: Before=20583249, After=20583085, chg -0.00%

[mcroce@redhat.com: tipc: remove two unused variables]
  Link: http://lkml.kernel.org/r/20190530091952.4108-1-mcroce@redhat.com
[akpm@linux-foundation.org: fix net/ipv6/sysctl_net_ipv6.c]
[arnd@arndb.de: proc/sysctl: make firmware loader table conditional]
  Link: http://lkml.kernel.org/r/20190617130014.1713870-1-arnd@arndb.de
[akpm@linux-foundation.org: fix fs/eventpoll.c]
Link: http://lkml.kernel.org/r/20190430180111.10688-1-mcroce@redhat.com
Signed-off-by: Matteo Croce <mcroce@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Aaron Tomlin <atomlin@redhat.com>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2019-07-18 17:08:07 -07:00
..
amd drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
arc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 174 2019-05-30 11:26:41 -07:00
arm drm/komeda: Make Komeda interrupts shareable 2019-06-21 10:47:15 +01:00
armada drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
aspeed treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
ast drm/ast: Pin framebuffer BO during dirty update 2019-06-13 13:37:19 +02:00
atmel-hlcdc drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
bochs Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
bridge drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
cirrus Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
etnaviv drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
exynos drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
fsl-dcu treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
gma500 Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
hisilicon drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
i2c drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
i810 treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
i915 proc/sysctl: add shared variables for range check 2019-07-18 17:08:07 -07:00
imx drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
ingenic DRM: Add KMS driver for the Ingenic JZ47xx SoCs 2019-06-19 13:24:14 +02:00
lib
lima drm/lima: add timeout to drm scheduler init 2019-05-21 20:47:36 +08:00
mcde drm/mcde: Fix an uninitialized variable 2019-06-13 11:55:23 +02:00
mediatek Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
meson Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
mga treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
mgag200 Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
msm drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
mxsfb treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
nouveau drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
omapdrm drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
panel drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
panfrost drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
pl111 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
qxl Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
r128 drm/r128: drop use of drmP.h 2019-06-05 20:31:19 +02:00
radeon Merge branch 'drm-next' into drm-next-5.3 2019-06-25 08:42:25 -05:00
rcar-du drm/rcar-du: Fix error check when retrieving crtc state 2019-06-18 11:44:00 -04:00
rockchip drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
savage drm/savage: drop use of drmP.h 2019-06-05 20:31:04 +02:00
scheduler drm/sched: Fix make htmldocs warnings. 2019-05-29 11:49:51 -05:00
selftests drm/selftests: Add command line parser selftests 2019-06-19 12:17:52 +02:00
shmobile video: backlight: Remove useless BACKLIGHT_LCD_SUPPORT kernel symbol 2019-04-03 11:15:57 +01:00
sis drm/sis: drop drmP.h use 2019-06-05 20:29:57 +02:00
sti sti: no need to check return value of debugfs_create functions 2019-06-13 17:35:49 +02:00
stm drm/stm: drv: fix suspend/resume 2019-06-20 17:03:24 +02:00
sun4i Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
tdfx treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
tegra drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
tilcdc treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
tinydrm treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
ttm Revert "Merge branch 'vmwgfx-next' of git://people.freedesktop.org/~thomash/linux into drm-next" 2019-07-16 04:07:13 +10:00
tve200 treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 443 2019-06-05 17:37:17 +02:00
udl treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 262 2019-06-05 17:30:28 +02:00
v3d drm-misc-next for v5.3, try #2: 2019-05-28 08:59:11 +10:00
vboxvideo Merge drm/drm-next into drm-misc-next 2019-05-22 16:08:21 -04:00
vc4 drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
vgem treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
via treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
virtio drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
vkms drm/vkms: add crc sources list 2019-06-18 22:56:31 -03:00
vmwgfx drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
xen treewide: Add SPDX license identifier - Makefile/Kconfig 2019-05-21 10:50:46 +02:00
zte drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
Kconfig docs conversion for v5.3-rc1 2019-07-16 12:21:41 -07:00
Makefile DRM: Add KMS driver for the Ingenic JZ47xx SoCs 2019-06-19 13:24:14 +02:00
ati_pcigart.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_agpsupport.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_atomic.c drm: Add helpers to kick off self refresh mode in drivers 2019-06-13 14:31:10 -04:00
drm_atomic_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_atomic_state_helper.c drm/atomic: Add a function to reset connector TV properties 2019-06-19 12:17:52 +02:00
drm_atomic_uapi.c drm: Add helpers to kick off self refresh mode in drivers 2019-06-13 14:31:10 -04:00
drm_auth.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_blend.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_bridge.c drm: Add atomic variants for bridge enable/disable 2019-06-13 13:00:29 -04:00
drm_bufs.c drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
drm_cache.c
drm_client.c drm/fb-helper: Remove drm_fb_helper_crtc 2019-06-04 12:13:47 +02:00
drm_client_modeset.c drm/modes: Allow to specify rotation and reflection on the commandline 2019-06-19 12:17:51 +02:00
drm_color_mgmt.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_connector.c drm/modes: Support modes names on the command line 2019-06-19 12:17:50 +02:00
drm_context.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_crtc.c drm: no need to check return value of debugfs_create functions 2019-06-13 16:39:16 +02:00
drm_crtc_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_crtc_helper_internal.h
drm_crtc_internal.h drm/atomic: Move __drm_atomic_helper_disable_plane/set_config() 2019-06-08 16:46:37 +02:00
drm_damage_helper.c drm/damage-helper: Use NULL instead of 0 2019-05-28 09:03:06 +02:00
drm_debugfs.c drm: debugfs: make drm_debugfs_create_files() never fail 2019-06-14 16:59:51 +02:00
drm_debugfs_crc.c drm: no need to check return value of debugfs_create functions 2019-06-13 16:39:16 +02:00
drm_dma.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_dp_aux_dev.c drm/dp: drmP.h include removal 2019-05-06 16:00:48 +03:00
drm_dp_cec.c
drm_dp_dual_mode_helper.c drm/dp: drmP.h include removal 2019-05-06 16:00:48 +03:00
drm_dp_helper.c drm/dp: Add DP_DPCD_QUIRK_NO_SINK_COUNT 2019-06-14 19:11:10 +03:00
drm_dp_mst_topology.c drm/mst: Fix MST sideband up-reply failure handling 2019-05-29 20:12:34 +03:00
drm_drv.c drm: no need to check return value of debugfs_create functions 2019-06-13 16:39:16 +02:00
drm_dsc.c drm/dsc: Split DSC PPS and SDP header initialisations 2019-03-05 13:24:34 -05:00
drm_dumb_buffers.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_edid.c drm/edid: use for_each_displayid_db where applicable 2019-06-25 14:44:03 +10:00
drm_edid_load.c Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2019-05-28 09:39:08 +02:00
drm_encoder.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_encoder_slave.c
drm_fb_cma_helper.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
drm_fb_helper.c drm/client: Change drm_client_panel_rotation name 2019-06-19 12:17:49 +02:00
drm_file.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_flip_work.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_format_helper.c drm: Remove users of drm_format_info_plane_cpp 2019-05-20 13:35:56 +02:00
drm_fourcc.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_framebuffer.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_gem.c drm/gem: Unexport drm_gem_(un)pin/v(un)map 2019-06-17 17:37:01 +02:00
drm_gem_cma_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_gem_framebuffer_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_gem_shmem_helper.c drm/gem_shmem: Use a writecombine mapping for ->vaddr 2019-06-10 09:14:01 -06:00
drm_gem_vram_helper.c drm: Remove functions with kmap-object argument from GEM VRAM helpers 2019-06-13 13:37:36 +02:00
drm_hashtab.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_hdcp.c drm/hdcp: drm_hdcp_request_srm() as static 2019-05-13 22:05:54 +02:00
drm_internal.h drm/gem: Unexport drm_gem_(un)pin/v(un)map 2019-06-17 17:37:01 +02:00
drm_ioc32.c drm main pull request for v5.3-rc1 (sans mm changes) 2019-07-15 19:04:27 -07:00
drm_ioctl.c docs conversion for v5.3-rc1 2019-07-16 12:21:41 -07:00
drm_irq.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_kms_helper_common.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_lease.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_legacy.h drm: make drm_legacy.h self-contained 2019-05-27 18:06:47 +02:00
drm_legacy_misc.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_lock.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_memory.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_mipi_dsi.c bus_find_device: Unify the match callback with class_find_device 2019-06-24 05:22:31 +02:00
drm_mm.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_mode_config.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_mode_object.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_modes.c drm/modes: Parse overscan properties 2019-06-19 12:17:51 +02:00
drm_modeset_helper.c drm: prepare for drmP.h removal from drm_modeset_helper.h 2019-02-07 21:48:28 +01:00
drm_modeset_lock.c docs conversion for v5.3-rc1 2019-07-16 12:21:41 -07:00
drm_of.c Merge remote-tracking branch 'drm/drm-next' into drm-misc-next 2019-05-28 09:39:08 +02:00
drm_panel.c drm/panel: Small documentation polish 2019-01-12 13:08:12 +01:00
drm_panel_orientation_quirks.c drm: panel-orientation-quirks: Add quirk for GPD MicroPC 2019-06-08 15:07:06 +02:00
drm_pci.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_plane.c drm/lease: Make sure implicit planes are leased 2019-04-24 11:30:32 +02:00
drm_plane_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_prime.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_print.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_probe_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_property.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_rect.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_scatter.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_scdc_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_self_refresh_helper.c drm/self_refresh: Fix possible NULL deref in failure path 2019-06-20 10:03:21 -04:00
drm_simple_kms_helper.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_syncobj.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_sysfs.c Linux 5.2-rc5 2019-06-19 12:07:29 +02:00
drm_trace.h drm: make drm_trace.h self-contained 2019-05-27 18:06:54 +02:00
drm_trace_points.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_vblank.c drm: add debug print to update_vblank_count 2019-06-14 19:10:04 +03:00
drm_vm.c drm: Permit video-buffers writecombine mapping for MIPS 2019-06-18 15:41:33 -04:00
drm_vma_manager.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_vram_helper_common.c drm: Replace drm_gem_vram_push_to_system() with kunmap + unpin 2019-05-22 12:43:29 +02:00
drm_vram_mm_helper.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00
drm_writeback.c drm: drop use of drmP.h in drm/* 2019-05-27 18:07:03 +02:00