Matthias, ping? Any suggestions?
Thanks,
Pingfan
On Thu, May 2, 2019 at 2:22 PM Pingfan Liu [off-list ref] wrote:
On Thu, Apr 25, 2019 at 4:20 PM Pingfan Liu [off-list ref] wrote:
quoted
On Wed, Apr 24, 2019 at 4:31 PM Matthias Brugger [off-list ref] wrote:
quoted
[...]
quoted
quoted
@@ -139,6 +141,8 @@ static int __init parse_crashkernel_simple(char *cmdline,
pr_warn("crashkernel: unrecognized char: %c\n", *cur);
return -EINVAL;
}
+ if (*crash_size == 0)
+ return -EINVAL;
This covers the case where I pass an argument like "crashkernel=0M" ?
Can't we fix that by using kstrtoull() in memparse and check if the return value
is < 0? In that case we could return without updating the retptr and we will be
fine.
After a series of work, I suddenly realized that it can not be done
like this way. "0M" causes kstrtoull() to return -EINVAL, but this is
caused by "M", not "0". If passing "0" to kstrtoull(), it will return
0 on success.
quoted
quoted
It seems that kstrtoull() treats 0M as invalid parameter, while
simple_strtoull() does not.
My careless going through the code. And I tested with a valid value
"256M" using kstrtoull(), it also returned -EINVAL.
So I think there is no way to distinguish 0 from a positive value
inside this basic math function.
Do I miss anything?
Thanks and regards,
Pingfan