* [PATCH 1/1] kernel/res_counter.c: replace simple_strtoull by kstrtoull
@ 2014-05-07 20:37 Fabian Frederick
2014-05-07 22:34 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Fabian Frederick @ 2014-05-07 20:37 UTC (permalink / raw)
To: linux-kernel; +Cc: akpm, Michal Hocko
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Fabian Frederick <fabf@skynet.be>
---
kernel/res_counter.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/kernel/res_counter.c b/kernel/res_counter.c
index 51dbac6..09c1a6a 100644
--- a/kernel/res_counter.c
+++ b/kernel/res_counter.c
@@ -183,11 +183,12 @@ int res_counter_memparse_write_strategy(const char *buf,
{
char *end;
unsigned long long res;
+ int rc;
/* return RES_COUNTER_MAX(unlimited) if "-1" is specified */
if (*buf == '-') {
- res = simple_strtoull(buf + 1, &end, 10);
- if (res != 1 || *end != '\0')
+ rc = kstrtoull(buf + 1, 10, &res);
+ if ((res != 1) || (rc))
return -EINVAL;
*resp = RES_COUNTER_MAX;
return 0;
--
1.8.4.5
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] kernel/res_counter.c: replace simple_strtoull by kstrtoull
2014-05-07 20:37 [PATCH 1/1] kernel/res_counter.c: replace simple_strtoull by kstrtoull Fabian Frederick
@ 2014-05-07 22:34 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2014-05-07 22:34 UTC (permalink / raw)
To: Fabian Frederick; +Cc: linux-kernel, Michal Hocko
On Wed, 7 May 2014 22:37:32 +0200 Fabian Frederick <fabf@skynet.be> wrote:
> --- a/kernel/res_counter.c
> +++ b/kernel/res_counter.c
> @@ -183,11 +183,12 @@ int res_counter_memparse_write_strategy(const char *buf,
> {
> char *end;
> unsigned long long res;
> + int rc;
>
> /* return RES_COUNTER_MAX(unlimited) if "-1" is specified */
> if (*buf == '-') {
> - res = simple_strtoull(buf + 1, &end, 10);
> - if (res != 1 || *end != '\0')
> + rc = kstrtoull(buf + 1, 10, &res);
There's no need to give `rc' function-wide scope.
int rc = kstrtoull(buf + 1, 10, &res);
will work here.
> + if ((res != 1) || (rc))
And that's over-parenthesized.
> return -EINVAL;
> *resp = RES_COUNTER_MAX;
> return 0;
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-05-07 22:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-05-07 20:37 [PATCH 1/1] kernel/res_counter.c: replace simple_strtoull by kstrtoull Fabian Frederick
2014-05-07 22:34 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).