linux-modules.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Aaron Tomlin <atomlin@redhat.com>
To: mcgrof@kernel.org, christophe.leroy@csgroup.eu
Cc: linux-kernel@vger.kernel.org, linux-modules@vger.kernel.org,
	atomlin@atomlin.com, oleksandr@natalenko.name, neelx@redhat.com
Subject: [PATCH v2 2/3] module: Use strscpy() for last_unloaded_module
Date: Thu, 14 Jul 2022 16:39:32 +0100	[thread overview]
Message-ID: <20220714153933.2095776-3-atomlin@redhat.com> (raw)
In-Reply-To: <20220714153933.2095776-1-atomlin@redhat.com>

The use of strlcpy() is considered deprecated [1].
In this particular context, there is no need to remain with strlcpy().
Therefore we transition to strscpy().

[1]: https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy

Signed-off-by: Aaron Tomlin <atomlin@redhat.com>
---
 kernel/module/main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/module/main.c b/kernel/module/main.c
index a4d23b0ebbc0..c5db13d06995 100644
--- a/kernel/module/main.c
+++ b/kernel/module/main.c
@@ -754,7 +754,7 @@ SYSCALL_DEFINE2(delete_module, const char __user *, name_user,
 	async_synchronize_full();
 
 	/* Store the name of the last unloaded module for diagnostic purposes */
-	strlcpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
+	strscpy(last_unloaded_module, mod->name, sizeof(last_unloaded_module));
 
 	free_module(mod);
 	/* someone could wait for the module in add_unformed_module() */
-- 
2.34.3


  parent reply	other threads:[~2022-07-14 15:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-14 15:39 [PATCH v2 0/3] module: Show the last unloaded module's taint flag(s) Aaron Tomlin
2022-07-14 15:39 ` [PATCH v2 1/3] module: Modify module_flags() to accept show_state argument Aaron Tomlin
2022-07-14 15:39 ` Aaron Tomlin [this message]
2022-07-14 15:39 ` [PATCH v2 3/3] module: Show the last unloaded module's taint flag(s) Aaron Tomlin
2022-07-15  0:43 ` [PATCH v2 0/3] " Luis Chamberlain

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=20220714153933.2095776-3-atomlin@redhat.com \
    --to=atomlin@redhat.com \
    --cc=atomlin@atomlin.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=neelx@redhat.com \
    --cc=oleksandr@natalenko.name \
    /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).