Commit a6e3918b authored by Markus Elfring's avatar Markus Elfring Committed by Daniel Vetter

GPU-DRM-Savage: Use memdup_user() rather than duplicating

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/021efa32-c259-e799-a80e-630972291815@users.sourceforge.net
parent 1832040d
...@@ -1001,15 +1001,9 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_ ...@@ -1001,15 +1001,9 @@ int savage_bci_cmdbuf(struct drm_device *dev, void *data, struct drm_file *file_
cmdbuf->cmd_addr = kcmd_addr; cmdbuf->cmd_addr = kcmd_addr;
} }
if (cmdbuf->vb_size) { if (cmdbuf->vb_size) {
kvb_addr = kmalloc(cmdbuf->vb_size, GFP_KERNEL); kvb_addr = memdup_user(cmdbuf->vb_addr, cmdbuf->vb_size);
if (kvb_addr == NULL) { if (IS_ERR(kvb_addr)) {
ret = -ENOMEM; ret = PTR_ERR(kvb_addr);
goto done;
}
if (copy_from_user(kvb_addr, cmdbuf->vb_addr,
cmdbuf->vb_size)) {
ret = -EFAULT;
goto done; goto done;
} }
cmdbuf->vb_addr = kvb_addr; cmdbuf->vb_addr = kvb_addr;
......
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