drm/panel: fix null pointer dereference on pointer mode
Subsystems (5)
PATCH 1/1 drm/panel: fix null pointer dereference on pointer mode
From: Colin Ian King <[email protected]>
Currently a null pointer check on pointer mode is passing mode to function drm_mode_vrefresh and this causes a null pointer dereference on mode. Fix this by not calling drm_mode_vrefresh since the call is only required for error reporting.
Addresses-Coverity: ("Dereference after null check")
--- drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +2 -3
@@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel, mode =drm_mode_duplicate (connector->dev, &default_mode);if (!mode) { -dev_err (ctx->dev,"Failed to add mode %ux%u@%u\n" , - default_mode.hdisplay, default_mode.vdisplay, -drm_mode_vrefresh (mode)); +dev_err (ctx->dev,"Failed to add mode %ux%u\n" , + default_mode.hdisplay, default_mode.vdisplay);return -ENOMEM ; }
Signature · 1 line
2.27.0
Hi,
Quoted 19 lines · Colin King
From: Colin Ian King <[email protected]>
Currently a null pointer check on pointer mode is passing mode to function
drm_mode_vrefreshand this causes a null pointer dereference on mode. Fix this by not callingdrm_mode_vrefreshsince the call is only required for error reporting.Addresses-Coverity: ("Dereference after null check")
Fixes 72967d5616d3 ("drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel")Signed-off-by Colin Ian King <[email protected]>--- drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +0
-0
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c static int mantix_get_modes(struct drm_panel *panel, · line 208
Quoted 10 lines
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +2
-3@@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel, mode =drm_mode_duplicate (connector->dev, &default_mode);if (!mode) { -dev_err (ctx->dev,"Failed to add mode %ux%u@%u\n" , - default_mode.hdisplay, default_mode.vdisplay, -drm_mode_vrefresh (mode)); +dev_err (ctx->dev,"Failed to add mode %ux%u\n" , + default_mode.hdisplay, default_mode.vdisplay);return -ENOMEM ; }
drm_mode_vrefresh(&default_mode) gives some more clue what's going on - I have had a fix queued up in my tree already but if you send a v2 that's fine.
Thanks!
-- Guido
Quoted 4 lines
Signature · 2 lines
-- 2.27.0
Quoted 22 lines · Guido Günther
Hi,
Quoted 20 lines · Colin King
From: Colin Ian King <[email protected]>
Currently a null pointer check on pointer mode is passing mode to function
drm_mode_vrefreshand this causes a null pointer dereference on mode. Fix this by not callingdrm_mode_vrefreshsince the call is only required for error reporting.Addresses-Coverity: ("Dereference after null check")
Fixes 72967d5616d3 ("drm/panel: Add panel driver for the Mantix MLAF057WE51-X DSI panel")Signed-off-by Colin Ian King <[email protected]>--- drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +0
-0@@ -202,9 +202,8 @@ static int mantix_get_modes(struct drm_panel *panel,
Quoted 13 lines
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c static int mantix_get_modes(struct drm_panel *panel, · line 208
Quoted 9 lines
drivers/gpu/drm/panel/panel-mantix-mlaf057we51.c +2
-3mode =drm_mode_duplicate (connector->dev, &default_mode);if (!mode) { -dev_err (ctx->dev,"Failed to add mode %ux%u@%u\n" , - default_mode.hdisplay, default_mode.vdisplay, -drm_mode_vrefresh (mode)); +dev_err (ctx->dev,"Failed to add mode %ux%u\n" , + default_mode.hdisplay, default_mode.vdisplay);return -ENOMEM ; }
drm_mode_vrefresh(&default_mode)gives some more clue what's going on - I have had a fix queued up in my tree already but if you send a v2 that's fine.
I'll defer to your queued up fix.
Quoted 8 lines
Thanks!
-- GuidoQuoted 4 lines
Signature · 2 lines
-- 2.27.0