From: Jean Delvare <jdelvare@suse.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>, Baoquan He <bhe@redhat.com>,
Michal Hocko <mhocko@suse.com>
Subject: [PATCH v2 1/3] params: Fix the maximum length in param_get_string
Date: Thu, 28 Sep 2017 16:25:15 +0200 [thread overview]
Message-ID: <20170928162515.24846b4f@endymion> (raw)
In-Reply-To: <20170928162337.28ae03f4@endymion>
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.
Signed-off-by: Jean Delvare <jdelvare@suse.de>
---
Changes since v1:
* Patch added
kernel/params.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- linux-4.13.orig/kernel/params.c 2017-09-28 11:09:09.604089430 +0200
+++ linux-4.13/kernel/params.c 2017-09-28 11:09:47.573434740 +0200
@@ -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);
--
Jean Delvare
SUSE L3 Support
next prev parent reply other threads:[~2017-09-28 15:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-09-28 14:23 [PATCH v2 0/3] params: Fix potential buffer overflows Jean Delvare
2017-09-28 14:25 ` Jean Delvare [this message]
2017-09-28 14:26 ` [PATCH v2 2/3] params: Fix an overflow in param_attr_show Jean Delvare
2017-09-28 14:27 ` [PATCH v2 3/3] params: Improve STANDARD_PARAM_DEF readability Jean Delvare
2017-09-28 15:54 ` [PATCH v2 0/3] params: Fix potential buffer overflows Ingo Molnar
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170928162515.24846b4f@endymion \
--to=jdelvare@suse.de \
--cc=akpm@linux-foundation.org \
--cc=bhe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).