}
static ssize_t tlbflush_read_file(struct file *file, char __user *user_buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos)
{
char buf[32];
unsigned int len;
return simple_read_from_buffer(user_buf, count, ppos, buf, len);
}
-static ssize_t tlbflush_write_file(struct file *file,
- const char __user *user_buf, size_t count, loff_t *ppos)
+static ssize_t tlbflush_write_file(struct file *file, const char __user *user_buf,
+ size_t count, loff_t *ppos)
{
- char buf[32];
- ssize_t len;
int ceiling;
+ int err;
- len = min(count, sizeof(buf) - 1);
- if (copy_from_user(buf, user_buf, len))
- return -EFAULT;
-
- buf[len] = '\0';
- if (kstrtoint(buf, 0, &ceiling))
- return -EINVAL;
+ err = kstrtoint_from_user(user_buf, count, 0, &ceiling);
+ if (err)
+ return err;
if (ceiling < 0)
return -EINVAL;