diff options
author | Arnd Bergmann <arnd@arndb.de> | 2022-09-23 17:33:38 +0200 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2022-09-23 17:33:39 +0200 |
commit | a30f202fdc27f527900d095d95765c6e646a8db1 (patch) | |
tree | 71420265126af356c3fb6a974c8cf4092b96005f /drivers/firmware | |
parent | 3879b6604cf46eb10a498b686bcfb8c4412c6b2b (diff) | |
parent | fa586abcfe4b43e170d72586b6f11bcc48f6766c (diff) |
Merge tag 'tegra-for-6.1-firmware' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux into arm/drivers
firmware: tegra: Changes for v6.1-rc1
A simple cleanup for user memory usage in the BPMP debugfs support.
* tag 'tegra-for-6.1-firmware' of git://git.kernel.org/pub/scm/linux/kernel/git/tegra/linux:
firmware: tegra: Switch over to memdup_user()
Link: https://lore.kernel.org/r/20220916101957.1635854-3-thierry.reding@gmail.com
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Diffstat (limited to 'drivers/firmware')
-rw-r--r-- | drivers/firmware/tegra/bpmp-debugfs.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/firmware/tegra/bpmp-debugfs.c b/drivers/firmware/tegra/bpmp-debugfs.c index 0c440afd5224..9d3874cdaaee 100644 --- a/drivers/firmware/tegra/bpmp-debugfs.c +++ b/drivers/firmware/tegra/bpmp-debugfs.c @@ -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; |