diff options
author | Jean Delvare <jdelvare@suse.de> | 2017-10-03 16:16:35 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-10-03 17:54:26 -0700 |
commit | 90ceb2a3ad868f800eb1c9f4ede650daddd94b77 (patch) | |
tree | d6e2e4748e25bdcdaeb0972954abacf1cc74f00c /kernel/params.c | |
parent | d09b0137d204bebeaafed672bc5a244e9ac92edb (diff) | |
download | talos-obmc-linux-90ceb2a3ad868f800eb1c9f4ede650daddd94b77.tar.gz talos-obmc-linux-90ceb2a3ad868f800eb1c9f4ede650daddd94b77.zip |
kernel/params.c: fix the maximum length in param_get_string
The length parameter of strlcpy() is supposed to reflect the size of the
target buffer, not of the source string. Harmless in this case as the
buffer is PAGE_SIZE long and the source string is always much shorter than
this, but conceptually wrong, so let's fix it.
Link: http://lkml.kernel.org/r/20170928162515.24846b4f@endymion
Signed-off-by: Jean Delvare <jdelvare@suse.de>
Acked-by: Ingo Molnar <mingo@kernel.org>
Cc: Baoquan He <bhe@redhat.com>
Cc: Michal Hocko <mhocko@suse.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/params.c')
-rw-r--r-- | kernel/params.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/params.c b/kernel/params.c index 1cd8f1a895a8..8283ba045f4f 100644 --- a/kernel/params.c +++ b/kernel/params.c @@ -507,7 +507,7 @@ EXPORT_SYMBOL(param_set_copystring); int param_get_string(char *buffer, const struct kernel_param *kp) { const struct kparam_string *kps = kp->str; - return strlcpy(buffer, kps->string, kps->maxlen); + return strlcpy(buffer, kps->string, PAGE_SIZE); } EXPORT_SYMBOL(param_get_string); |