Skip to content

Commit

Permalink
rsxx: don't open-code memdup_user()
Browse files Browse the repository at this point in the history
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jan 6, 2016
1 parent 8ed6010 commit 820351f
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions drivers/block/rsxx/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 820351f

Please sign in to comment.