Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7ad61e6b authored by Markus Elfring's avatar Markus Elfring Committed by Daniel Vetter
Browse files

virtio-gpu: Use memdup_user() rather than duplicating its implementation



Reuse existing functionality from memdup_user() instead of keeping
duplicate source code.

This issue was detected by using the Coccinelle software.

Signed-off-by: default avatarMarkus Elfring <elfring@users.sourceforge.net>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/401e68fc-5515-7a7a-be2e-503dee676b34@users.sourceforge.net
parent a6e3918b
Loading
Loading
Loading
Loading
+4 −9
Original line number Original line Diff line number Diff line
@@ -152,15 +152,10 @@ static int virtio_gpu_execbuffer(struct drm_device *dev,
	if (ret)
	if (ret)
		goto out_free;
		goto out_free;


	buf = kmalloc(exbuf->size, GFP_KERNEL);
	buf = memdup_user((void __user *)(uintptr_t)exbuf->command,
	if (!buf) {
			  exbuf->size);
		ret = -ENOMEM;
	if (IS_ERR(buf)) {
		goto out_unresv;
		ret = PTR_ERR(buf);
	}
	if (copy_from_user(buf, (void __user *)(uintptr_t)exbuf->command,
			   exbuf->size)) {
		kfree(buf);
		ret = -EFAULT;
		goto out_unresv;
		goto out_unresv;
	}
	}
	virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,
	virtio_gpu_cmd_submit(vgdev, buf, exbuf->size,