From: "tip-bot2 for Xu Panda" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Xu Panda <xu.panda@zte.com.cn>, Yang Yang <yang.yang29@zte.com>,
Ingo Molnar <mingo@kernel.org>, Tony Luck <tony.luck@intel.com>,
x86@kernel.org, linux-kernel@vger.kernel.org
Subject: [tip: x86/platform] x86/mce/dev-mcelog: use strscpy() to instead of strncpy()
Date: Sat, 07 Jan 2023 11:37:11 -0000 [thread overview]
Message-ID: <167309143194.4906.10220848041501270532.tip-bot2@tip-bot2> (raw)
In-Reply-To: <202212031419324523731@zte.com.cn>
The following commit has been merged into the x86/platform branch of tip:
Commit-ID: 7ddf0050a21fdcc025c3cb1055fe3db60df1cd97
Gitweb: https://git.kernel.org/tip/7ddf0050a21fdcc025c3cb1055fe3db60df1cd97
Author: Xu Panda <xu.panda@zte.com.cn>
AuthorDate: Sat, 03 Dec 2022 14:19:32 +08:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Sat, 07 Jan 2023 11:47:35 +01:00
x86/mce/dev-mcelog: use strscpy() to instead of strncpy()
The implementation of strscpy() is more robust and safer.
That's now the recommended way to copy NUL terminated strings.
Signed-off-by: Xu Panda <xu.panda@zte.com.cn>
Signed-off-by: Yang Yang <yang.yang29@zte.com>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Reviewed-by: Tony Luck <tony.luck@intel.com>
Link: https://lore.kernel.org/r/202212031419324523731@zte.com.cn
---
arch/x86/kernel/cpu/mce/dev-mcelog.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/mce/dev-mcelog.c b/arch/x86/kernel/cpu/mce/dev-mcelog.c
index 100fbee..a05ac07 100644
--- a/arch/x86/kernel/cpu/mce/dev-mcelog.c
+++ b/arch/x86/kernel/cpu/mce/dev-mcelog.c
@@ -105,8 +105,7 @@ static ssize_t set_trigger(struct device *s, struct device_attribute *attr,
{
char *p;
- strncpy(mce_helper, buf, sizeof(mce_helper));
- mce_helper[sizeof(mce_helper)-1] = 0;
+ strscpy(mce_helper, buf, sizeof(mce_helper));
p = strchr(mce_helper, '\n');
if (p)
prev parent reply other threads:[~2023-01-07 11:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-03 6:19 [PATCH linux-next] " yang.yang29
2022-12-03 22:21 ` Luck, Tony
2022-12-14 20:54 ` Ricardo Neri
2022-12-14 21:29 ` Luck, Tony
2022-12-14 22:54 ` Ricardo Neri
2023-01-07 11:37 ` tip-bot2 for Xu Panda [this message]
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=167309143194.4906.10220848041501270532.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=tony.luck@intel.com \
--cc=x86@kernel.org \
--cc=xu.panda@zte.com.cn \
--cc=yang.yang29@zte.com \
/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
all inboxes | Powered by JetHome®