Browse Source

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>
Alex Deucher 12 years ago
parent
commit
aaed41ec5b
1 changed files with 2 additions and 0 deletions
  1. 2 0
      drivers/gpu/drm/drm_edid.c

+ 2 - 0
drivers/gpu/drm/drm_edid.c

@@ -2925,6 +2925,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;