The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Thorsten Blum <thorsten.blum@linux.dev>
To: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>
Cc: Thorsten Blum <thorsten.blum@linux.dev>, linux-kernel@vger.kernel.org
Subject: [PATCH 3/3] fs: hpfs: replace deprecated strcpy with memcpy in hpfs_set_ea
Date: Tue, 19 May 2026 18:45:12 +0200	[thread overview]
Message-ID: <20260519164509.180686-6-thorsten.blum@linux.dev> (raw)
In-Reply-To: <20260519164509.180686-4-thorsten.blum@linux.dev>

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@linux.dev>
---
 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;

      parent reply	other threads:[~2026-05-19 16:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19 16:45 [PATCH 1/3] fs: hpfs: remove commented out code in hpfs_set_ea Thorsten Blum
2026-05-19 16:45 ` [PATCH 2/3] fs: hpfs: calculate key length only once " Thorsten Blum
2026-05-19 16:45 ` Thorsten Blum [this message]

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=20260519164509.180686-6-thorsten.blum@linux.dev \
    --to=thorsten.blum@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mikulas@artax.karlin.mff.cuni.cz \
    /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