mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-14 07:36:11 +07:00
drm/tilcdc: fix leak & null ref in panel_connector_get_modes
If videomode_from_timings() returns true, the mode allocated with drm_mode_create will be leaked. Also, the return value of drm_mode_create() is never checked, and thus could cause NULL deref. Fix these two issues. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Link: https://patchwork.freedesktop.org/patch/msgid/20200429104234.18910-1-tomi.valkeinen@ti.com Reviewed-by: Jyri Sarha <jsarha@ti.com> Acked-by: Sam Ravnborg <sam@ravnborg.org>
This commit is contained in:
parent
5bebaeadb3
commit
3f9c1c872c
@ -139,12 +139,16 @@ static int panel_connector_get_modes(struct drm_connector *connector)
|
|||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < timings->num_timings; i++) {
|
for (i = 0; i < timings->num_timings; i++) {
|
||||||
struct drm_display_mode *mode = drm_mode_create(dev);
|
struct drm_display_mode *mode;
|
||||||
struct videomode vm;
|
struct videomode vm;
|
||||||
|
|
||||||
if (videomode_from_timings(timings, &vm, i))
|
if (videomode_from_timings(timings, &vm, i))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
mode = drm_mode_create(dev);
|
||||||
|
if (!mode)
|
||||||
|
break;
|
||||||
|
|
||||||
drm_display_mode_from_videomode(&vm, mode);
|
drm_display_mode_from_videomode(&vm, mode);
|
||||||
|
|
||||||
mode->type = DRM_MODE_TYPE_DRIVER;
|
mode->type = DRM_MODE_TYPE_DRIVER;
|
||||||
|
Loading…
Reference in New Issue
Block a user