intel-gfx.lists.freedesktop.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/i915/display: fix display param dup for NULL char * params
@ 2024-04-02 15:55 Jani Nikula
  2024-04-02 16:24 ` Lucas De Marchi
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Jani Nikula @ 2024-04-02 15:55 UTC (permalink / raw)
  To: intel-gfx, intel-xe; +Cc: jani.nikula, Jouni Högander, Luca Coelho, stable

The display param duplication deviates from the original param
duplication in that it converts NULL params to to allocated empty
strings. This works for the vbt_firmware parameter, but not for
dmc_firmware_path, the user of which interprets NULL and the empty
string as distinct values. Specifically, the empty dmc_firmware_path
leads to DMC and PM being disabled.

Just remove the NULL check and pass it to kstrdup(), which safely
returns NULL for NULL input.

Fixes: 8015bee0bfec ("drm/i915/display: Add framework to add parameters specific to display")
Fixes: 0d82a0d6f556 ("drm/i915/display: move dmc_firmware_path to display params")
Cc: Jouni Högander <jouni.hogander@intel.com>
Cc: Luca Coelho <luciano.coelho@intel.com>
Cc: <stable@vger.kernel.org> # v6.8+
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 drivers/gpu/drm/i915/display/intel_display_params.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_display_params.c b/drivers/gpu/drm/i915/display/intel_display_params.c
index c8e3d6892e23..49c6b42077dc 100644
--- a/drivers/gpu/drm/i915/display/intel_display_params.c
+++ b/drivers/gpu/drm/i915/display/intel_display_params.c
@@ -176,9 +176,9 @@ void intel_display_params_dump(struct drm_i915_private *i915, struct drm_printer
 #undef PRINT
 }
 
-__maybe_unused static void _param_dup_charp(char **valp)
+static void _param_dup_charp(char **valp)
 {
-	*valp = kstrdup(*valp ? *valp : "", GFP_ATOMIC);
+	*valp = kstrdup(*valp, GFP_ATOMIC);
 }
 
 __maybe_unused static void _param_nop(void *valp)
-- 
2.39.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-04-03  8:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-04-02 15:55 [PATCH] drm/i915/display: fix display param dup for NULL char * params Jani Nikula
2024-04-02 16:24 ` Lucas De Marchi
2024-04-02 16:49   ` Jani Nikula
2024-04-02 18:14 ` ✗ Fi.CI.CHECKPATCH: warning for " Patchwork
2024-04-02 18:28 ` ✗ Fi.CI.BAT: failure " Patchwork
2024-04-03  8:03 ` [PATCH] " Jani Nikula

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).