372cd0d665c3da7f55707a9006d4dca218d8b7d0
[openwrt/openwrt.git] /
1 From d89b3f22cf7b6bba8081f6d16c9087019fdcf586 Mon Sep 17 00:00:00 2001
2 From: Hans de Goede <hdegoede@redhat.com>
3 Date: Mon, 18 Nov 2019 16:51:32 +0100
4 Subject: [PATCH] drm/modes: parse_cmdline: Explicitly memset the
5 passed in drm_cmdline_mode struct
6
7 Commit d1fe276b5115f0d581c3cfe6154633b3547e8aab upstream.
8
9 Instead of only setting mode->specified on false on an early exit and
10 leaving e.g. mode->bpp_specified and mode->refresh_specified as is,
11 lets be consistent and just zero out the entire passed in struct at
12 the top of drm_mode_parse_command_line_for_connector()
13
14 Changes in v3:
15 -Drop "mode->specified = false;" line instead of the "return false;" (oops)
16 This crasher was reported-by: kernel test robot <lkp@intel.com>
17
18 Acked-by: Maxime Ripard <mripard@kernel.org>
19 Signed-off-by: Hans de Goede <hdegoede@redhat.com>
20 Link: https://patchwork.freedesktop.org/patch/msgid/20191118155134.30468-11-hdegoede@redhat.com
21 ---
22 drivers/gpu/drm/drm_modes.c | 5 ++---
23 1 file changed, 2 insertions(+), 3 deletions(-)
24
25 --- a/drivers/gpu/drm/drm_modes.c
26 +++ b/drivers/gpu/drm/drm_modes.c
27 @@ -1752,12 +1752,11 @@ bool drm_mode_parse_command_line_for_con
28 char *bpp_end_ptr = NULL, *refresh_end_ptr = NULL;
29 int i, len, ret;
30
31 + memset(mode, 0, sizeof(*mode));
32 mode->panel_orientation = DRM_MODE_PANEL_ORIENTATION_UNKNOWN;
33
34 - if (!mode_option) {
35 - mode->specified = false;
36 + if (!mode_option)
37 return false;
38 - }
39
40 name = mode_option;
41