From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>,
stable@dpdk.org, Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Harman Kalra <hkalra@marvell.com>,
Jerin Jacob <jerinj@marvell.com>,
Srikanth Yalavarthi <syalavarthi@marvell.com>,
Rakesh Kudurumalla <rkudurumalla@marvell.com>
Subject: [PATCH 01/17] common/cnxk: replace strncpy with strlcpy
Date: Tue, 23 Jun 2026 17:51:31 +0100 [thread overview]
Message-ID: <20260623165150.765443-2-bruce.richardson@intel.com> (raw)
In-Reply-To: <20260623165150.765443-1-bruce.richardson@intel.com>
Replace strncpy() with safer strlcpy() which always null-terminates.
Fixes: 014a9e222bac ("common/cnxk: add model init and IO handling API")
Fixes: b315581c66dc ("common/cnxk: skip probing SoC environment for CN9K")
Cc: stable@dpdk.org
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
drivers/common/cnxk/roc_model.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/common/cnxk/roc_model.c b/drivers/common/cnxk/roc_model.c
index f0312a5400..ddd7ee8634 100644
--- a/drivers/common/cnxk/roc_model.c
+++ b/drivers/common/cnxk/roc_model.c
@@ -211,15 +211,15 @@ populate_model(struct roc_model *model, uint32_t midr)
if (model_db[i].impl == impl && model_db[i].part == part &&
model_db[i].major == major && model_db[i].minor == minor) {
model->flag = model_db[i].flag;
- strncpy(model->name, model_db[i].name,
- ROC_MODEL_STR_LEN_MAX - 1);
+ strlcpy(model->name, model_db[i].name,
+ ROC_MODEL_STR_LEN_MAX);
found = true;
break;
}
not_found:
if (!found) {
model->flag = 0;
- strncpy(model->name, "unknown", ROC_MODEL_STR_LEN_MAX - 1);
+ strlcpy(model->name, "unknown", ROC_MODEL_STR_LEN_MAX);
plt_err("Invalid RoC model (impl=0x%x, part=0x%x, major=0x%x, minor=0x%x)",
impl, part, major, minor);
}
@@ -297,7 +297,7 @@ of_env_get(struct roc_model *model)
FILE *fp;
if (access(path, F_OK) != 0) {
- strncpy(model->env, "HW_PLATFORM", ROC_MODEL_STR_LEN_MAX - 1);
+ strlcpy(model->env, "HW_PLATFORM", ROC_MODEL_STR_LEN_MAX);
model->flag |= ROC_ENV_HW;
return;
}
--
2.53.0
next prev parent reply other threads:[~2026-06-23 16:52 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-23 16:51 [PATCH 00/17] drivers: replace strncpy with strlcpy Bruce Richardson
2026-06-23 16:51 ` Bruce Richardson [this message]
2026-06-23 16:51 ` [PATCH 02/17] common/mlx5: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 03/17] crypto/mvsam: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 04/17] crypto/scheduler: " Bruce Richardson
2026-06-23 16:59 ` Bruce Richardson
2026-06-23 16:51 ` [PATCH 05/17] event/cnxk: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 06/17] net/ark: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 07/17] net/bnx2x: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 08/17] net/cnxk: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 09/17] net/dpaa: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 10/17] net/ionic: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 11/17] net/mlx4: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 12/17] net/mlx5: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 13/17] net/nfp: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 14/17] net/qede: " Bruce Richardson
2026-06-23 17:02 ` Bruce Richardson
2026-06-23 16:51 ` [PATCH 15/17] net/softnic: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 16/17] net/vhost: " Bruce Richardson
2026-06-23 16:51 ` [PATCH 17/17] net/virtio: " Bruce Richardson
2026-06-23 17:33 ` [PATCH 00/17] drivers: " Stephen Hemminger
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=20260623165150.765443-2-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
--cc=hkalra@marvell.com \
--cc=jerinj@marvell.com \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=rkudurumalla@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
--cc=stable@dpdk.org \
--cc=syalavarthi@marvell.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.