mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-16 01:04:08 +08: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
@ -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 New Issue
Block a user