Skip to content

Commit

Permalink
staging: cs5535_gpio: check put_user() return code
Browse files Browse the repository at this point in the history
put_user() may fail, if so return -EFAULT.

Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Vasiliy Kulikov authored and Greg Kroah-Hartman committed Jan 21, 2011
1 parent 2f644cc commit 01ebd76
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/staging/cs5535_gpio/cs5535_gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,8 @@ static ssize_t cs5535_gpio_read(struct file *file, char __user *buf,

/* add a line-feed if there is room */
if ((i == ARRAY_SIZE(rm)) && (count < len)) {
put_user('\n', buf + count);
if (put_user('\n', buf + count))
return -EFAULT;
count++;
}

Expand Down

0 comments on commit 01ebd76

Please sign in to comment.