Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm: Check if the allocation has succeeded before dereferencing newmode

We allocate memory in drm_display_mode_from_vic_index() and use it
without checking the pointer is valid. Fix that.

Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

authored by

Damien Lespiau and committed by
Daniel Vetter
409bbf1e 366d4807

+3
+3
drivers/gpu/drm/drm_edid.c
··· 2580 2580 return NULL; 2581 2581 2582 2582 newmode = drm_mode_duplicate(dev, &edid_cea_modes[cea_mode]); 2583 + if (!newmode) 2584 + return NULL; 2585 + 2583 2586 newmode->vrefresh = 0; 2584 2587 2585 2588 return newmode;