[PATCH 3/3] fs: hpfs: replace deprecated strcpy with memcpy in hpfs_set_ea
From: Thorsten Blum
Date: Tue May 19 2026 - 12:58:33 EST
strcpy() is deprecated [1] and uses an additional strlen() internally;
use memcpy() directly since we already know the length of the key and
that it is guaranteed to be NUL-terminated.
[1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strcpy
Signed-off-by: Thorsten Blum <thorsten.blum@xxxxxxxxx>
---
fs/hpfs/ea.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/hpfs/ea.c b/fs/hpfs/ea.c
index 1d7c1f67be9f..66776cb4f3fc 100644
--- a/fs/hpfs/ea.c
+++ b/fs/hpfs/ea.c
@@ -254,7 +254,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
ea->namelen = key_len;
ea->valuelen_lo = size;
ea->valuelen_hi = size >> 8;
- strcpy(ea->name, key);
+ memcpy(ea->name, key, key_len + 1);
memcpy(ea_data(ea), data, size);
fnode->ea_size_s = cpu_to_le16(le16_to_cpu(fnode->ea_size_s) + key_len + size + 5);
goto ret;