drm/edid: catch kmalloc failure in drm_edid_to_speaker_allocation
[firefly-linux-kernel-4.4.55.git] / 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;