From: Jules Maselbas <jmaselbas@zdiv.net>
To: barebox@lists.infradead.org
Cc: Jules Maselbas <jmaselbas@zdiv.net>
Subject: [PATCH 1/2] eeprom: at25: replace strncpy with strlcpy
Date: Fri, 14 Mar 2025 11:45:01 +0100 [thread overview]
Message-ID: <20250314104502.14851-1-jmaselbas@zdiv.net> (raw)
strncpy will not nul terminate the dst string in case the src is longer
than the the dst size, strlcpy will truncate and nul terminate the string.
Signed-off-by: Jules Maselbas <jmaselbas@zdiv.net>
---
drivers/eeprom/at25.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/eeprom/at25.c b/drivers/eeprom/at25.c
index ca1df82122..43e72677c9 100644
--- a/drivers/eeprom/at25.c
+++ b/drivers/eeprom/at25.c
@@ -243,7 +243,7 @@ static int at25_np_to_chip(struct device *dev,
return -ENODEV;
memset(chip, 0, sizeof(*chip));
- strncpy(chip->name, np->name, sizeof(chip->name));
+ strlcpy(chip->name, np->name, sizeof(chip->name));
if (of_property_read_u32(np, "size", &val) == 0 ||
of_property_read_u32(np, "at25,byte-len", &val) == 0) {
--
2.48.1
next reply other threads:[~2025-03-14 11:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-14 10:45 Jules Maselbas [this message]
2025-03-14 10:45 ` [PATCH 2/2] eeprom: at25: add explicit fallthrough Jules Maselbas
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=20250314104502.14851-1-jmaselbas@zdiv.net \
--to=jmaselbas@zdiv.net \
--cc=barebox@lists.infradead.org \
/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