diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-02 20:58:07 +0100 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-01-06 14:25:24 +0100 |
commit | 820351f05be93623c6e71b5d618f90f0deebc134 (patch) | |
tree | ec84e7ca27e680945425f161681e004516fb4a80 /drivers/block/rsxx | |
parent | mtip32xx: don't open-code memdup_user() (diff) | |
download | linux-820351f05be93623c6e71b5d618f90f0deebc134.tar.xz linux-820351f05be93623c6e71b5d618f90f0deebc134.zip |
rsxx: don't open-code memdup_user()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/block/rsxx')
-rw-r--r-- | drivers/block/rsxx/core.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/block/rsxx/core.c b/drivers/block/rsxx/core.c index d8b2488aaade..34997df132e2 100644 --- a/drivers/block/rsxx/core.c +++ b/drivers/block/rsxx/core.c @@ -203,14 +203,11 @@ static ssize_t rsxx_cram_write(struct file *fp, const char __user *ubuf, char *buf; ssize_t st; - buf = kzalloc(cnt, GFP_KERNEL); - if (!buf) - return -ENOMEM; + buf = memdup_user(ubuf, cnt); + if (IS_ERR(buf)) + return PTR_ERR(buf); - st = copy_from_user(buf, ubuf, cnt); - if (!st) - st = rsxx_creg_write(card, CREG_ADD_CRAM + (u32)*ppos, cnt, - buf, 1); + st = rsxx_creg_write(card, CREG_ADD_CRAM + (u32)*ppos, cnt, buf, 1); kfree(buf); if (st) return st; |