lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <54f9c382-f38b-4847-909a-2f9b122ab6d2@davidwei.uk>
Date: Fri, 8 Dec 2023 14:04:36 -0800
From: David Wei <dw@...idwei.uk>
To: Jakub Kicinski <kuba@...nel.org>
Cc: netdev@...r.kernel.org, "David S. Miller" <davem@...emloft.net>,
 Eric Dumazet <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>
Subject: Re: [PATCH net-next 1/3] netdevsim: allow two netdevsim ports to be

On 2023-12-08 09:58, Jakub Kicinski wrote:
> On Thu,  7 Dec 2023 09:21:15 -0800 David Wei wrote:
>> +	ret = copy_from_user(buf, data, count);
>> +	if (ret)
>> +		return -EFAULT;
>> +	buf[count] = '\0';
>> +
>> +	cur = buf;
>> +	token = strsep(&cur, " ");
>> +	if (!token)
>> +		return -EINVAL;
>> +	ret = kstrtouint(token, 10, &id);
>> +	if (ret)
>> +		return ret;
>> +
>> +	token = strsep(&cur, " ");
>> +	if (!token)
>> +		return -EINVAL;
>> +	ret = kstrtouint(token, 10, &port);
>> +	if (ret)
>> +		return ret;
>> +
>> +	/* too many args */
>> +	if (strsep(&cur, " "))
>> +		return -E2BIG;
> 
> What's wrong with scanf?

Also responded to Jiri:

I went with strstep() instead of sscanf() because sscanf("%u %u", ...)
does not fail with echo "1 2 3 4". I'm happy to use sscanf() though if
this is not an issue.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ