linux_dsm_epyc7002/drivers/gpu/drm/amd/display
Nicholas Kazlauskas 090afc1e40 drm/amd/display: Fix overflow/truncation from strncpy.
[Why]

New GCC warnings for stringop-truncation and stringop-overflow help
catch common misuse of strncpy. This patch suppresses these warnings
by fixing bugs identified by them.

[How]

Since the parameter passed for name in amdpgu_dm_create_common_mode has
no fixed length, if the string is >= DRM_DISPLAY_MODE_LEN then
mode->name will not be null-terminated.

The truncation in fill_audio_info won't actually occur (and the string
will be null-terminated since the buffer is initialized to zero), but
the warning can be suppressed by using the proper buffer size.

This patch fixes both issues by using the real size for the buffer and
making use of strscpy (which always terminates).

Signed-off-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
2018-12-04 15:01:56 -05:00
..
amdgpu_dm drm/amd/display: Fix overflow/truncation from strncpy. 2018-12-04 15:01:56 -05:00
dc drm/amd/display: Fix 6x4K displays light-up on Vega20 (v2) 2018-11-29 14:36:03 -05:00
include drm/amd/display: Add a check-function for virtual signal type 2018-10-09 17:01:48 -05:00
modules drm/amd/display: fix bug of accessing invalid memory 2018-10-15 16:17:17 -05:00
Kconfig drm/amd/display: Add DC config flag for Raven2 (v2) 2018-09-14 09:36:56 -05:00
Makefile drm/amd/display: Enable Stereo in Dal3 2018-08-27 11:10:57 -05:00
TODO drm/amd/display: Convert remaining loggers off dc_logger 2018-07-13 14:48:42 -05:00