Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/modes: parse_cmdline: Explicitly memset the passed in drm_cmdline_mode struct

Instead of only setting mode->specified on false on an early exit and
leaving e.g. mode->bpp_specified and mode->refresh_specified as is,
lets be consistent and just zero out the entire passed in struct at
the top of drm_mode_parse_command_line_for_connector()

Changes in v3:
-Drop "mode->specified = false;" line instead of the "return false;" (oops)
This crasher was reported-by: kernel test robot <lkp@intel.com>

Acked-by: Maxime Ripard <mripard@kernel.org>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20191118155134.30468-11-hdegoede@redhat.com

+2 -3
+2 -3
drivers/gpu/drm/drm_modes.c
··· 1745 1745 char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL; 1746 1746 int i, len, ret; 1747 1747 1748 + memset(mode, 0, sizeof(*mode)); 1748 1749 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN; 1749 1750 1750 - if (!mode_option) { 1751 - mode->specified = false; 1751 + if (!mode_option) 1752 1752 return false; 1753 - } 1754 1753 1755 1754 name = mode_option; 1756 1755