mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-20 17:41:09 +00:00
firmware: tegra: Switch over to memdup_user()
This patch fixes the following Coccinelle warning: drivers/firmware/tegra/bpmp-debugfs.c:379: WARNING opportunity for memdup_user Use memdup_user() rather than duplicating its implementation. This is a little bit restricted to reduce false positives. Signed-off-by: Qing Wang <wangqing@vivo.com> Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
parent
568035b01c
commit
fa586abcfe
1 changed files with 3 additions and 10 deletions
|
@ -377,18 +377,11 @@ static ssize_t bpmp_debug_store(struct file *file, const char __user *buf,
|
|||
if (!filename)
|
||||
return -ENOENT;
|
||||
|
||||
databuf = kmalloc(count, GFP_KERNEL);
|
||||
if (!databuf)
|
||||
return -ENOMEM;
|
||||
|
||||
if (copy_from_user(databuf, buf, count)) {
|
||||
err = -EFAULT;
|
||||
goto free_ret;
|
||||
}
|
||||
databuf = memdup_user(buf, count);
|
||||
if (IS_ERR(databuf))
|
||||
return PTR_ERR(databuf);
|
||||
|
||||
err = mrq_debug_write(bpmp, filename, databuf, count);
|
||||
|
||||
free_ret:
|
||||
kfree(databuf);
|
||||
|
||||
return err ?: count;
|
||||
|
|
Loading…
Reference in a new issue