From: Alex Deucher Date: Fri, 27 Sep 2013 22:46:09 +0000 (-0400) Subject: drm/edid: catch kmalloc failure in drm_edid_to_speaker_allocation X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=618e377608c046a696ad78fb3015db0c17719f3a;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm/edid: catch kmalloc failure in drm_edid_to_speaker_allocation Return -ENOMEM if the allocation fails. Signed-off-by: Alex Deucher Reviewed-by: Jani Nikula Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 3140a30aa818..9173be34b4c2 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -2937,6 +2937,8 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) /* Speaker Allocation Data Block */ if (dbl == 3) { *sadb = kmalloc(dbl, GFP_KERNEL); + if (!*sadb) + return -ENOMEM; memcpy(*sadb, &db[1], dbl); count = dbl; break;