Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6263ba55 authored by Peter Huewe's avatar Peter Huewe Committed by Greg Kroah-Hartman
Browse files

staging: speakup: Use kstrtoul_from_user



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

Kernel Version: staging of 20110606

Signed-off-by: default avatarPeter Huewe <peterhuewe@gmx.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 919ed52f
Loading
Loading
Loading
Loading
+1 −8
Original line number Diff line number Diff line
@@ -273,15 +273,8 @@ static ssize_t softsynth_write(struct file *fp, const char *buf, size_t count,
{
	unsigned long supplied_index = 0;
	int converted;
	char indbuf[5];
	if (count >= sizeof(indbuf))
		return -EINVAL;

	if (copy_from_user(indbuf, buf, count))
		return -EFAULT;
	indbuf[count] = '\0';

	converted = strict_strtoul(indbuf, 0, &supplied_index);
	converted = kstrtoul_from_user(buf, count, 0, &supplied_index);

	if (converted < 0)
		return converted;