From: Benoit Taine Date: Mon, 26 May 2014 15:21:22 +0000 (+0200) Subject: drm/edid: Use kmemdup instead of kmalloc + memcpy X-Git-Tag: Ubuntu-5.0.0-8.9~11385^2~45 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=89086bca67f04a538765faf39ea7c1b718beaf34;p=mirror_ubuntu-disco-kernel.git drm/edid: Use kmemdup instead of kmalloc + memcpy This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 7a4fd2ed1280..d74239fec291 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -3228,10 +3228,9 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) /* Speaker Allocation Data Block */ if (dbl == 3) { - *sadb = kmalloc(dbl, GFP_KERNEL); + *sadb = kmemdup(&db[1], dbl, GFP_KERNEL); if (!*sadb) return -ENOMEM; - memcpy(*sadb, &db[1], dbl); count = dbl; break; }