linux/drivers/gpu/drm
Linus Torvalds fec4d42724 drm/i915/display: fix compiler warning about array overrun
intel_dp_check_mst_status() uses a 14-byte array to read the DPRX Event
Status Indicator data, but then passes that buffer at offset 10 off as
an argument to drm_dp_channel_eq_ok().

End result: there are only 4 bytes remaining of the buffer, yet
drm_dp_channel_eq_ok() wants a 6-byte buffer.  gcc-11 correctly warns
about this case:

  drivers/gpu/drm/i915/display/intel_dp.c: In function ‘intel_dp_check_mst_status’:
  drivers/gpu/drm/i915/display/intel_dp.c:3491:22: warning: ‘drm_dp_channel_eq_ok’ reading 6 bytes from a region of size 4 [-Wstringop-overread]
   3491 |                     !drm_dp_channel_eq_ok(&esi[10], intel_dp->lane_count)) {
        |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  drivers/gpu/drm/i915/display/intel_dp.c:3491:22: note: referencing argument 1 of type ‘const u8 *’ {aka ‘const unsigned char *’}
  In file included from drivers/gpu/drm/i915/display/intel_dp.c:38:
  include/drm/drm_dp_helper.h:1466:6: note: in a call to function ‘drm_dp_channel_eq_ok’
   1466 | bool drm_dp_channel_eq_ok(const u8 link_status[DP_LINK_STATUS_SIZE],
        |      ^~~~~~~~~~~~~~~~~~~~
       6:14 elapsed

This commit just extends the original array by 2 zero-initialized bytes,
avoiding the warning.

There may be some underlying bug in here that caused this confusion, but
this is at least no worse than the existing situation that could use
random data off the stack.

Cc: Jani Nikula <jani.nikula@intel.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2021-05-08 11:30:22 -07:00
..
amd IOMMU Updates for Linux v5.13 2021-05-01 09:33:00 -07:00
arm
armada
aspeed
ast
atmel-hlcdc
bochs
bridge A few fixes for the next merge window, with some build fixes for anx7625 2021-04-23 13:53:07 +10:00
etnaviv Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
exynos Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
fsl-dcu
gma500
gud
hisilicon
i2c
i810
i915 drm/i915/display: fix compiler warning about array overrun 2021-05-08 11:30:22 -07:00
imx Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
ingenic
kmb
lib
lima drm for 5.13-rc1 2021-04-28 10:01:40 -07:00
mcde
mediatek
meson
mga
mgag200
msm IOMMU Updates for Linux v5.13 2021-05-01 09:33:00 -07:00
mxsfb
nouveau Merge branch 'stable/for-linus-5.13' of git://git.kernel.org/pub/scm/linux/kernel/git/konrad/swiotlb 2021-05-04 10:58:49 -07:00
omapdrm Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
panel Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
panfrost drm for 5.13-rc1 2021-04-28 10:01:40 -07:00
pl111
qxl treewide: remove editor modelines and cruft 2021-05-07 00:26:34 -07:00
r128
radeon drm tegra-next + fixes for 5.13-rc1 2021-04-30 12:44:02 -07:00
rcar-du Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
rockchip
savage
scheduler
selftests
shmobile
sis
sti
stm
sun4i
tdfx
tegra drm/tegra: Changes for v5.13-rc1 2021-04-30 09:57:07 +10:00
tidss
tilcdc
tiny
ttm Two patches in drm-misc-next-fixes this week, one to fix the error 2021-04-30 10:13:48 +10:00
tve200
udl
v3d
vboxvideo
vc4 Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
vgem
via
virtio
vkms
vmwgfx drm tegra-next + fixes for 5.13-rc1 2021-04-30 12:44:02 -07:00
xen Merge drm/drm-fixes into drm-next 2021-04-13 23:15:09 +02:00
xlnx
zte
drm_agpsupport.c
drm_atomic_helper.c
drm_atomic_state_helper.c
drm_atomic_uapi.c
drm_atomic.c
drm_auth.c
drm_blend.c
drm_bridge_connector.c
drm_bridge.c
drm_bufs.c
drm_cache.c
drm_client_modeset.c
drm_client.c
drm_color_mgmt.c
drm_connector.c
drm_context.c
drm_crtc_helper_internal.h
drm_crtc_helper.c
drm_crtc_internal.h
drm_crtc.c
drm_damage_helper.c
drm_debugfs_crc.c
drm_debugfs.c
drm_displayid.c
drm_dma.c
drm_dp_aux_dev.c
drm_dp_cec.c
drm_dp_dual_mode_helper.c
drm_dp_helper.c
drm_dp_mst_topology_internal.h
drm_dp_mst_topology.c
drm_drv.c
drm_dsc.c
drm_dumb_buffers.c
drm_edid_load.c
drm_edid.c
drm_encoder_slave.c
drm_encoder.c
drm_fb_cma_helper.c
drm_fb_helper.c
drm_file.c
drm_flip_work.c
drm_format_helper.c
drm_fourcc.c
drm_framebuffer.c
drm_gem_atomic_helper.c
drm_gem_cma_helper.c
drm_gem_framebuffer_helper.c
drm_gem_shmem_helper.c
drm_gem_ttm_helper.c
drm_gem_vram_helper.c
drm_gem.c
drm_hashtab.c
drm_hdcp.c
drm_internal.h
drm_ioc32.c
drm_ioctl.c
drm_irq.c
drm_kms_helper_common.c
drm_lease.c
drm_legacy_misc.c
drm_legacy.h
drm_lock.c
drm_managed.c
drm_memory.c
drm_mipi_dbi.c
drm_mipi_dsi.c
drm_mm.c
drm_mode_config.c
drm_mode_object.c
drm_modes.c drm for 5.13-rc1 2021-04-28 10:01:40 -07:00
drm_modeset_helper.c
drm_modeset_lock.c
drm_of.c
drm_panel_orientation_quirks.c
drm_panel.c
drm_pci.c
drm_plane_helper.c
drm_plane.c
drm_prime.c
drm_print.c
drm_probe_helper.c
drm_property.c
drm_rect.c
drm_scatter.c
drm_scdc_helper.c
drm_self_refresh_helper.c
drm_simple_kms_helper.c
drm_syncobj.c
drm_sysfs.c
drm_trace_points.c
drm_trace.h
drm_vblank_work.c
drm_vblank.c
drm_vm.c
drm_vma_manager.c
drm_writeback.c
Kconfig
Makefile