linux-hardening.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] audit: Replace deprecated strcpy() with strscpy()
@ 2025-07-18 20:37 Thorsten Blum
  2025-07-18 21:52 ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Thorsten Blum @ 2025-07-18 20:37 UTC (permalink / raw)
  To: Paul Moore, Eric Paris
  Cc: linux-hardening, Thorsten Blum, audit, linux-kernel

strcpy() is deprecated; use strscpy() instead.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
 kernel/audit_tree.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/kernel/audit_tree.c b/kernel/audit_tree.c
index b0eae2a3c895..1605df0a171e 100644
--- a/kernel/audit_tree.c
+++ b/kernel/audit_tree.c
@@ -93,8 +93,10 @@ static struct kmem_cache *audit_tree_mark_cachep __ro_after_init;
 static struct audit_tree *alloc_tree(const char *s)
 {
 	struct audit_tree *tree;
+	size_t sz;
 
-	tree = kmalloc(struct_size(tree, pathname, strlen(s) + 1), GFP_KERNEL);
+	sz = strlen(s) + 1;
+	tree = kmalloc(struct_size(tree, pathname, sz), GFP_KERNEL);
 	if (tree) {
 		refcount_set(&tree->count, 1);
 		tree->goner = 0;
@@ -103,7 +105,7 @@ static struct audit_tree *alloc_tree(const char *s)
 		INIT_LIST_HEAD(&tree->list);
 		INIT_LIST_HEAD(&tree->same_root);
 		tree->root = NULL;
-		strcpy(tree->pathname, s);
+		strscpy(tree->pathname, s, sz);
 	}
 	return tree;
 }
-- 
2.50.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: Replace deprecated strcpy() with strscpy()
  2025-07-18 20:37 [PATCH] audit: Replace deprecated strcpy() with strscpy() Thorsten Blum
@ 2025-07-18 21:52 ` Paul Moore
  2025-08-05 19:57   ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2025-07-18 21:52 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Eric Paris, linux-hardening, audit, linux-kernel

On Fri, Jul 18, 2025 at 4:38 PM Thorsten Blum <thorsten.blum@linux.dev> wrote:
>
> strcpy() is deprecated; use strscpy() instead.
>
> Link: https://github.com/KSPP/linux/issues/88
> Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> ---
>  kernel/audit_tree.c | 6 ++++--
>  1 file changed, 4 insertions(+), 2 deletions(-)

This looks fine to me, but as we are at -rc6 I'm going to hold off on
merging this until after the upcoming merge window.

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: Replace deprecated strcpy() with strscpy()
  2025-07-18 21:52 ` Paul Moore
@ 2025-08-05 19:57   ` Paul Moore
  2025-08-11 22:21     ` Paul Moore
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Moore @ 2025-08-05 19:57 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Eric Paris, linux-hardening, audit, linux-kernel

On Fri, Jul 18, 2025 at 5:52 PM Paul Moore <paul@paul-moore.com> wrote:
> On Fri, Jul 18, 2025 at 4:38 PM Thorsten Blum <thorsten.blum@linux.dev> wrote:
> >
> > strcpy() is deprecated; use strscpy() instead.
> >
> > Link: https://github.com/KSPP/linux/issues/88
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> >  kernel/audit_tree.c | 6 ++++--
> >  1 file changed, 4 insertions(+), 2 deletions(-)
>
> This looks fine to me, but as we are at -rc6 I'm going to hold off on
> merging this until after the upcoming merge window.

Merged into audit/dev-staging for testing, audit/dev will happen after
merge window closes.

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] audit: Replace deprecated strcpy() with strscpy()
  2025-08-05 19:57   ` Paul Moore
@ 2025-08-11 22:21     ` Paul Moore
  0 siblings, 0 replies; 4+ messages in thread
From: Paul Moore @ 2025-08-11 22:21 UTC (permalink / raw)
  To: Thorsten Blum; +Cc: Eric Paris, linux-hardening, audit, linux-kernel

On Tue, Aug 5, 2025 at 3:57 PM Paul Moore <paul@paul-moore.com> wrote:
> On Fri, Jul 18, 2025 at 5:52 PM Paul Moore <paul@paul-moore.com> wrote:
> > On Fri, Jul 18, 2025 at 4:38 PM Thorsten Blum <thorsten.blum@linux.dev> wrote:
> > >
> > > strcpy() is deprecated; use strscpy() instead.
> > >
> > > Link: https://github.com/KSPP/linux/issues/88
> > > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > > ---
> > >  kernel/audit_tree.c | 6 ++++--
> > >  1 file changed, 4 insertions(+), 2 deletions(-)
> >
> > This looks fine to me, but as we are at -rc6 I'm going to hold off on
> > merging this until after the upcoming merge window.
>
> Merged into audit/dev-staging for testing, audit/dev will happen after
> merge window closes.

Merged into audit/dev, thanks!

-- 
paul-moore.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-11 22:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-18 20:37 [PATCH] audit: Replace deprecated strcpy() with strscpy() Thorsten Blum
2025-07-18 21:52 ` Paul Moore
2025-08-05 19:57   ` Paul Moore
2025-08-11 22:21     ` Paul Moore

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).