From: Ashutosh Yadav <yadavxashutosh@gmail.com>
To: corey@minyard.net
Cc: openipmi-developer@lists.sourceforge.net,
linux-kernel@vger.kernel.org,
Ashutosh Yadav <yadavxashutosh@gmail.com>
Subject: [PATCH v1] char: ipmi: Replace deprecated strcpy with strscpy
Date: Thu, 1 Oct 2026 22:52:09 +0530 [thread overview]
Message-ID: <20261001172209.52028-1-yadavxashutosh@gmail.com> (raw)
strcpy() has been deprecated because it is generally unsafe and can lead
to buffer overflows. It is actively being removed from the kernel.
In action_op() and preop_op() (and related functions), strings are copied
into fixed-size buffers. Replace the strcpy() calls with strscpy() using
the sizeof() the destination buffers to guarantee NUL-termination and
prevent any potential bounds issues, ensuring compliance with safe string
APIs.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Ashutosh Yadav <yadavxashutosh@gmail.com>
---
drivers/char/ipmi/ipmi_watchdog.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/char/ipmi/ipmi_watchdog.c b/drivers/char/ipmi/ipmi_watchdog.c
index a013ddbf1466..79d4958df6ef 100644
--- a/drivers/char/ipmi/ipmi_watchdog.c
+++ b/drivers/char/ipmi/ipmi_watchdog.c
@@ -1166,13 +1166,13 @@ static int action_op(const char *inval, char *outval)
int rv;
if (outval)
- strcpy(outval, action);
+ strscpy(outval, action, sizeof(action));
if (!inval)
return 0;
rv = action_op_set_val(inval);
if (!rv)
- strcpy(action, inval);
+ strscpy(action, inval, sizeof(action));
return rv;
}
@@ -1198,13 +1198,13 @@ static int preaction_op(const char *inval, char *outval)
int rv;
if (outval)
- strcpy(outval, preaction);
+ strscpy(outval, preaction, sizeof(preaction));
if (!inval)
return 0;
rv = preaction_op_set_val(inval);
if (!rv)
- strcpy(preaction, inval);
+ strscpy(preaction, inval, sizeof(preaction));
return 0;
}
@@ -1226,14 +1226,14 @@ static int preop_op(const char *inval, char *outval)
int rv;
if (outval)
- strcpy(outval, preop);
+ strscpy(outval, preop, sizeof(preop));
if (!inval)
return 0;
rv = preop_op_set_val(inval);
if (!rv)
- strcpy(preop, inval);
+ strscpy(preop, inval, sizeof(preop));
return 0;
}
--
2.43.0
next reply other threads:[~2026-10-01 17:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-01 17:22 Ashutosh Yadav [this message]
2026-10-01 22:14 ` Corey Minyard
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=20261001172209.52028-1-yadavxashutosh@gmail.com \
--to=yadavxashutosh@gmail.com \
--cc=corey@minyard.net \
--cc=linux-kernel@vger.kernel.org \
--cc=openipmi-developer@lists.sourceforge.net \
/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®