aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Deucher2013-09-27 18:46:09 -0400
committerDave Airlie2013-10-01 15:28:57 +1000
commit618e377608c046a696ad78fb3015db0c17719f3a (patch)
tree4759109414a27e920b91609a8ad501faa5f5b26f
parent0aec288130713cf7bcf97c929ac5fab6a8e00e44 (diff)
drm/edid: catch kmalloc failure in drm_edid_to_speaker_allocation
Return -ENOMEM if the allocation fails. Signed-off-by: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/drm_edid.c2
1 files changed, 2 insertions, 0 deletions
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;