drm/edid: catch kmalloc failure in drm_edid_to_speaker_allocation
authorAlex Deucher <alexdeucher@gmail.com>
Fri, 27 Sep 2013 22:46:09 +0000 (18:46 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 1 Oct 2013 05:28:57 +0000 (15:28 +1000)
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>
drivers/gpu/drm/drm_edid.c

index 3140a30aa8188150ece08b638253e181d9ada63b..9173be34b4c2a942cdb2798d95eccc431bc1e42b 100644 (file)
@@ -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;