]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kernel-res_counterc-replace-simple_strtoull-by-kstrtoull-fix
authorAndrew Morton <akpm@linux-foundation.org>
Thu, 22 May 2014 00:43:31 +0000 (10:43 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 22 May 2014 00:43:31 +0000 (10:43 +1000)
don't overwrite kstrtoull()'s errno

Cc: Fabian Frederick <fabf@skynet.be>
Cc: Michal Hocko <mhocko@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
kernel/res_counter.c

index f65a95c4b09c4d84f4402ac51d6658048e13c253..e791130f85a7ace7bbfc4d412151b912d6b87d49 100644 (file)
@@ -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;