mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Serhat Kumral <serhatkumral1@gmail.com>
To: haris.iqbal@ionos.com, jinpu.wang@ionos.com
Cc: jgg@ziepe.ca, leon@kernel.org, danil.kipnis@cloud.ionos.com,
	linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org,
	Serhat Kumral <serhatkumral1@gmail.com>
Subject: [PATCH] RDMA/rtrs: Use strscpy() to cache the HCA name
Date: Fri,  9 Oct 2026 16:17:15 +0300	[thread overview]
Message-ID: <20261009131715.39217-1-serhatkumral1@gmail.com> (raw)

As the comment states, the HCA name is cached for sysfs. Use
strscpy() to copy it directly without unnecessary formatting and
avoid interpreting format specifiers in the name.

Fixes: 6a98d71daea1 ("RDMA/rtrs: client: main functionality")
Signed-off-by: Serhat Kumral <serhatkumral1@gmail.com>
---
found by smatch:
- drivers/infiniband/ulp/rtrs/rtrs-clt.c:1906 rtrs_rdma_conn_established() warn: call of 'scnprintf' with non-constant format argument

 drivers/infiniband/ulp/rtrs/rtrs-clt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/ulp/rtrs/rtrs-clt.c b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
index 927e3f30483c..c85e22f670ba 100644
--- a/drivers/infiniband/ulp/rtrs/rtrs-clt.c
+++ b/drivers/infiniband/ulp/rtrs/rtrs-clt.c
@@ -1918,8 +1918,8 @@ static int rtrs_rdma_conn_established(struct rtrs_clt_con *con,
 		 * Cache the hca_port and hca_name for sysfs
 		 */
 		clt_path->hca_port = con->c.cm_id->port_num;
-		scnprintf(clt_path->hca_name, sizeof(clt_path->hca_name),
-			  clt_path->s.dev->ib_dev->name);
+		strscpy(clt_path->hca_name, clt_path->s.dev->ib_dev->name,
+			sizeof(clt_path->hca_name));
 		clt_path->s.src_addr = con->c.cm_id->route.addr.src_addr;
 		/* set for_new_clt, to allow future reconnect on any path */
 		clt_path->for_new_clt = 1;
-- 
2.53.0


                 reply	other threads:[~2026-10-09 13:17 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261009131715.39217-1-serhatkumral1@gmail.com \
    --to=serhatkumral1@gmail.com \
    --cc=danil.kipnis@cloud.ionos.com \
    --cc=haris.iqbal@ionos.com \
    --cc=jgg@ziepe.ca \
    --cc=jinpu.wang@ionos.com \
    --cc=leon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rdma@vger.kernel.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

all inboxes | Powered by JetHome®