From fec40298be5af6d098a2c9dfd4a82e712a7efccb Mon Sep 17 00:00:00 2001 From: Andrew Morton Date: Thu, 22 May 2014 10:43:31 +1000 Subject: [PATCH] kernel-res_counterc-replace-simple_strtoull-by-kstrtoull-fix don't overwrite kstrtoull()'s errno Cc: Fabian Frederick Cc: Michal Hocko Cc: Tejun Heo Signed-off-by: Andrew Morton --- kernel/res_counter.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/kernel/res_counter.c b/kernel/res_counter.c index f65a95c4b09c..e791130f85a7 100644 --- a/kernel/res_counter.c +++ b/kernel/res_counter.c @@ -187,7 +187,10 @@ int res_counter_memparse_write_strategy(const char *buf, /* return RES_COUNTER_MAX(unlimited) if "-1" is specified */ if (*buf == '-') { int rc = kstrtoull(buf + 1, 10, &res); - if ((res != 1) || rc) + + if (rc) + return rc; + if (res != 1) return -EINVAL; *resp = RES_COUNTER_MAX; return 0; -- 2.39.5