From: "Michał Mirosław" <mirq-linux@rere.qmqm.pl>
To: Qing Wang <wangqing@vivo.com>
Cc: Thierry Reding <thierry.reding@gmail.com>,
Jonathan Hunter <jonathanh@nvidia.com>,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] firmware: tegra: switch over to memdup_user()
Date: Thu, 21 Oct 2021 03:15:37 +0200 [thread overview]
Message-ID: <YXC/OesonB81PVmm@qmqm.qmqm.pl> (raw)
In-Reply-To: <1634543982-36727-1-git-send-email-wangqing@vivo.com>
On Mon, Oct 18, 2021 at 12:59:40AM -0700, Qing Wang wrote:
[...]
> --- a/drivers/firmware/tegra/bpmp-debugfs.c
> +++ b/drivers/firmware/tegra/bpmp-debugfs.c
> @@ -376,18 +376,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 ERR_PTR(PTR_ERR(databuf));
ERR_PTR() is too much here.
Best Regards
Michał Mirosław
next prev parent reply other threads:[~2021-10-21 1:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-18 7:59 [PATCH] firmware: tegra: switch over to memdup_user() Qing Wang
2021-10-21 1:15 ` Michał Mirosław [this message]
[not found] ` <AJsAPABcEiDeZ4ZDMvu*CapV.9.1634778945247.Hmail.wangqing@vivo.com>
2021-10-21 1:27 ` 回复: " 王擎
2021-10-18 11:31 Qing Wang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=YXC/OesonB81PVmm@qmqm.qmqm.pl \
--to=mirq-linux@rere.qmqm.pl \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@gmail.com \
--cc=wangqing@vivo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).