projects
/
GitHub
/
LineageOS
/
android_kernel_motorola_exynos9610.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
76bf569
)
spi: spidev: use memdup_user
author
Geliang Tang
<geliangtang@gmail.com>
Sat, 6 May 2017 15:42:17 +0000
(23:42 +0800)
committer
Mark Brown
<broonie@kernel.org>
Sun, 14 May 2017 09:38:05 +0000
(18:38 +0900)
Use memdup_user() helper instead of open-coding to simplify the code.
Signed-off-by: Geliang Tang <geliangtang@gmail.com>
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/spi/spidev.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/spi/spidev.c
b/drivers/spi/spidev.c
index 3b570018705c61f088a6951cd9bf3d0069ea182e..d4d2d8d9f3e70cbf0ba47ef4c4b3dd2d512aca70 100644
(file)
--- a/
drivers/spi/spidev.c
+++ b/
drivers/spi/spidev.c
@@
-324,7
+324,6
@@
static struct spi_ioc_transfer *
spidev_get_ioc_message(unsigned int cmd, struct spi_ioc_transfer __user *u_ioc,
unsigned *n_ioc)
{
- struct spi_ioc_transfer *ioc;
u32 tmp;
/* Check type, command number and direction */
@@
-341,14
+340,7
@@
spidev_get_ioc_message(unsigned int cmd, struct spi_ioc_transfer __user *u_ioc,
return NULL;
/* copy into scratch area */
- ioc = kmalloc(tmp, GFP_KERNEL);
- if (!ioc)
- return ERR_PTR(-ENOMEM);
- if (__copy_from_user(ioc, u_ioc, tmp)) {
- kfree(ioc);
- return ERR_PTR(-EFAULT);
- }
- return ioc;
+ return memdup_user(u_ioc, tmp);
}
static long