diff options
author | Tony Lindgren <tony@atomide.com> | 2016-01-25 19:46:21 +0100 |
---|---|---|
committer | Tony Lindgren <tony@atomide.com> | 2016-01-25 19:46:21 +0100 |
commit | 7e3b1207705c10ada363bbc7d0235730ce1f5b79 (patch) | |
tree | cd1eb567acb4e72c1bdfbe8b59746c73b8627ee5 /drivers/sbus/char/openprom.c | |
parent | ARM: omap2plus_defconfig: Enable ARM_KERNMEM_PERMS and few loadable modules (diff) | |
parent | ARM: OMAP: Add PWM dmtimer platform data quirks (diff) | |
download | linux-7e3b1207705c10ada363bbc7d0235730ce1f5b79.tar.xz linux-7e3b1207705c10ada363bbc7d0235730ce1f5b79.zip |
Merge branch 'enable-devices' into omap-for-v4.5/fixes
Diffstat (limited to 'drivers/sbus/char/openprom.c')
-rw-r--r-- | drivers/sbus/char/openprom.c | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c index 5843288f64bc..e077ebd89319 100644 --- a/drivers/sbus/char/openprom.c +++ b/drivers/sbus/char/openprom.c @@ -390,16 +390,9 @@ static int copyin_string(char __user *user, size_t len, char **ptr) if ((ssize_t)len < 0 || (ssize_t)(len + 1) < 0) return -EINVAL; - tmp = kmalloc(len + 1, GFP_KERNEL); - if (!tmp) - return -ENOMEM; - - if (copy_from_user(tmp, user, len)) { - kfree(tmp); - return -EFAULT; - } - - tmp[len] = '\0'; + tmp = memdup_user_nul(user, len); + if (IS_ERR(tmp)) + return PTR_ERR(tmp); *ptr = tmp; |