Commit 89086bca authored by Benoit Taine's avatar Benoit Taine Committed by Dave Airlie

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: default avatarBenoit Taine <benoit.taine@lip6.fr>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent c66de8cc
...@@ -3228,10 +3228,9 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb) ...@@ -3228,10 +3228,9 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)
/* Speaker Allocation Data Block */ /* Speaker Allocation Data Block */
if (dbl == 3) { if (dbl == 3) {
*sadb = kmalloc(dbl, GFP_KERNEL); *sadb = kmemdup(&db[1], dbl, GFP_KERNEL);
if (!*sadb) if (!*sadb)
return -ENOMEM; return -ENOMEM;
memcpy(*sadb, &db[1], dbl);
count = dbl; count = dbl;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment