blob: 372cd0d665c3da7f55707a9006d4dca218d8b7d0 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001From d89b3f22cf7b6bba8081f6d16c9087019fdcf586 Mon Sep 17 00:00:00 2001
2From: Hans de Goede <hdegoede@redhat.com>
3Date: Mon, 18 Nov 2019 16:51:32 +0100
4Subject: [PATCH] drm/modes: parse_cmdline: Explicitly memset the
5 passed in drm_cmdline_mode struct
6
7Commit d1fe276b5115f0d581c3cfe6154633b3547e8aab upstream.
8
9Instead of only setting mode->specified on false on an early exit and
10leaving e.g. mode->bpp_specified and mode->refresh_specified as is,
11lets be consistent and just zero out the entire passed in struct at
12the top of drm_mode_parse_command_line_for_connector()
13
14Changes 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
18Acked-by: Maxime Ripard <mripard@kernel.org>
19Signed-off-by: Hans de Goede <hdegoede@redhat.com>
20Link: 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