Skip to content

Commit bbdca2d

Browse files
Qing Wangthierryreding
authored andcommitted
drm/tegra: Switch over to vmemdup_user()
This patch fixes the following Coccinelle warning: drivers/gpu/drm/tegra/submit.c:173: WARNING opportunity for vmemdup_user Use vmemdup_user() rather than duplicating its implementation. This is a little bit restricted to reduce false positives. Signed-off-by: Qing Wang <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 8935002 commit bbdca2d

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

drivers/gpu/drm/tegra/submit.c

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -169,14 +169,9 @@ static void *alloc_copy_user_array(void __user *from, size_t count, size_t size)
169169
if (copy_len > 0x4000)
170170
return ERR_PTR(-E2BIG);
171171

172-
data = kvmalloc(copy_len, GFP_KERNEL);
173-
if (!data)
174-
return ERR_PTR(-ENOMEM);
175-
176-
if (copy_from_user(data, from, copy_len)) {
177-
kvfree(data);
178-
return ERR_PTR(-EFAULT);
179-
}
172+
data = vmemdup_user(from, copy_len);
173+
if (IS_ERR(data))
174+
return ERR_CAST(data);
180175

181176
return data;
182177
}

0 commit comments

Comments
 (0)