]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
drm/edid: Use kmemdup instead of kmalloc + memcpy
authorBenoit Taine <benoit.taine@lip6.fr>
Mon, 26 May 2014 15:21:22 +0000 (17:21 +0200)
committerDave Airlie <airlied@redhat.com>
Tue, 27 May 2014 05:48:11 +0000 (15:48 +1000)
This issue was reported by coccicheck using the semantic patch
at scripts/coccinelle/api/memdup.cocci

Signed-off-by: Benoit Taine <benoit.taine@lip6.fr>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/drm_edid.c

index 7a4fd2ed1280b5d23e1ac46a0c70672a873986e2..d74239fec291a4fe7df742dad5b182dac3d0d6bb 100644 (file)
@@ -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;
                        }