projects
/
openwrt
/
staging
/
blogic.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
bf8d5d5
)
mm/vmpressure.c: use kstrndup instead of kmalloc+strncpy
author
Andy Shevchenko
<andriy.shevchenko@linux.intel.com>
Fri, 8 Jun 2018 00:07:50 +0000
(17:07 -0700)
committer
Linus Torvalds
<torvalds@linux-foundation.org>
Fri, 8 Jun 2018 00:34:36 +0000
(17:34 -0700)
Using kstrndup() simplifies the code.
Link:
http://lkml.kernel.org/r/20180503201807.24941-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/vmpressure.c
patch
|
blob
|
history
diff --git
a/mm/vmpressure.c
b/mm/vmpressure.c
index 85350ce2d25d736101063e13d90660f0639067b6..7142207224d3ea70a80dee62e92a8a77dadd6bc1 100644
(file)
--- a/
mm/vmpressure.c
+++ b/
mm/vmpressure.c
@@
-390,12
+390,11
@@
int vmpressure_register_event(struct mem_cgroup *memcg,
char *token;
int ret = 0;
- spec_orig = spec = k
zalloc(MAX_VMPRESSURE_ARGS_LEN + 1
, GFP_KERNEL);
+ spec_orig = spec = k
strndup(args, MAX_VMPRESSURE_ARGS_LEN
, GFP_KERNEL);
if (!spec) {
ret = -ENOMEM;
goto out;
}
- strncpy(spec, args, MAX_VMPRESSURE_ARGS_LEN);
/* Find required level */
token = strsep(&spec, ",");