Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

fuse: Convert to kstrtoul_from_user

This patch replaces the code for getting an number from a
userspace buffer by a simple call to kstroul_from_user.
This makes it easier to read and less error prone.

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>

authored by

Peter Huewe and committed by
Miklos Szeredi
e2690695 66f75a5d

+2 -8
+2 -8
fs/fuse/control.c
··· 75 75 unsigned global_limit) 76 76 { 77 77 unsigned long t; 78 - char tmp[32]; 79 78 unsigned limit = (1 << 16) - 1; 80 79 int err; 81 80 82 - if (*ppos || count >= sizeof(tmp) - 1) 81 + if (*ppos) 83 82 return -EINVAL; 84 83 85 - if (copy_from_user(tmp, buf, count)) 86 - return -EINVAL; 87 - 88 - tmp[count] = '\0'; 89 - 90 - err = strict_strtoul(tmp, 0, &t); 84 + err = kstrtoul_from_user(buf, count, 0, &t); 91 85 if (err) 92 86 return err; 93 87