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 | Merge tag 'tegra-for-6.1-soc' of git://git.kernel.org/pub/scm/linux/kernel/gi... (diff) | |
parent | firmware: tegra: Switch over to memdup_user() (diff) | |
download | linux-a30f202fdc27f527900d095d95765c6e646a8db1.tar.xz linux-a30f202fdc27f527900d095d95765c6e646a8db1.zip |
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; |