diff options
author | Yang Shi <yang.shi@linux.alibaba.com> | 2020-04-02 06:09:59 +0200 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2020-04-02 18:35:31 +0200 |
commit | 565dc842313fde3d0a2e817f96b42bd6a1eb0cad (patch) | |
tree | 96c7a1c7bd1749abeb64af931347745dc0ceffd3 /mm/vmpressure.c | |
parent | mm/page_alloc: simplify page_is_buddy() for better code readability (diff) | |
download | linux-565dc842313fde3d0a2e817f96b42bd6a1eb0cad.tar.xz linux-565dc842313fde3d0a2e817f96b42bd6a1eb0cad.zip |
mm: vmpressure: don't need call kfree if kstrndup fails
When kstrndup fails, no memory was allocated and we can exit directly.
[david@redhat.com: reword changelog]
Signed-off-by: Yang Shi <yang.shi@linux.alibaba.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: David Hildenbrand <david@redhat.com>
Acked-by: David Rientjes <rientjes@google.com>
Link: http://lkml.kernel.org/r/1581398649-125989-1-git-send-email-yang.shi@linux.alibaba.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/vmpressure.c')
-rw-r--r-- | mm/vmpressure.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/mm/vmpressure.c b/mm/vmpressure.c index 4bac22fe1aa2..0590f0033448 100644 --- a/mm/vmpressure.c +++ b/mm/vmpressure.c @@ -371,10 +371,8 @@ int vmpressure_register_event(struct mem_cgroup *memcg, int ret = 0; spec_orig = spec = kstrndup(args, MAX_VMPRESSURE_ARGS_LEN, GFP_KERNEL); - if (!spec) { - ret = -ENOMEM; - goto out; - } + if (!spec) + return -ENOMEM; /* Find required level */ token = strsep(&spec, ","); |