diff options
| author | Thorsten Blum <thorsten.blum@linux.dev> | 2025-07-18 22:37:34 +0200 |
|---|---|---|
| committer | Paul Moore <paul@paul-moore.com> | 2025-08-11 11:44:55 -0400 |
| commit | d8c09d7b55da39a10c8fd7f2b3a3f88f5f55764c (patch) | |
| tree | a97afaaf4628dd8ca9105434d7dd512bef3fc014 /kernel/audit_tree.c | |
| parent | c5055d0c8eddfb89ed895ae0642e2a2a0804143d (diff) | |
audit: Replace deprecated strcpy() with strscpy()
strcpy() is deprecated; use strscpy() instead.
Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
Signed-off-by: Paul Moore <paul@paul-moore.com>
Diffstat (limited to 'kernel/audit_tree.c')
| -rw-r--r-- | kernel/audit_tree.c | 6 |
1 files 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; } |
