Linux block layer
 help / color / mirror / Atom feed
From: Siddarth Gundu <siddarthsgml@gmail.com>
To: idryomov@gmail.com
Cc: dongsheng.yang@easystack.cn, axboe@kernel.dk,
	ceph-devel@vger.kernel.org, linux-block@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Siddarth Gundu <siddarthsgml@gmail.com>
Subject: [PATCH] rbd: replace strcpy() with strscpy()
Date: Wed, 14 May 2025 23:50:15 +0530	[thread overview]
Message-ID: <20250514182015.163117-1-siddarthsgml@gmail.com> (raw)

strcpy() is deprecated; use strscpy() instead.

Both the destination and source buffer are of fixed length
so strscpy with 2-arguments is used.

Link: https://github.com/KSPP/linux/issues/88
Signed-off-by: Siddarth Gundu <siddarthsgml@gmail.com>
---
 drivers/block/rbd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index faafd7ff43d6..92b38972db1c 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -39,6 +39,7 @@
 
 #include <linux/kernel.h>
 #include <linux/device.h>
+#include <linux/string.h>
 #include <linux/module.h>
 #include <linux/blk-mq.h>
 #include <linux/fs.h>
@@ -3654,7 +3655,7 @@ static void __rbd_lock(struct rbd_device *rbd_dev, const char *cookie)
 	struct rbd_client_id cid = rbd_get_cid(rbd_dev);
 
 	rbd_dev->lock_state = RBD_LOCK_STATE_LOCKED;
-	strcpy(rbd_dev->lock_cookie, cookie);
+	strscpy(rbd_dev->lock_cookie, cookie);
 	rbd_set_owner_cid(rbd_dev, &cid);
 	queue_work(rbd_dev->task_wq, &rbd_dev->acquired_lock_work);
 }
-- 
2.43.0


             reply	other threads:[~2025-05-14 18:20 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-14 18:20 Siddarth Gundu [this message]
2025-05-14 18:52 ` [PATCH] rbd: replace strcpy() with strscpy() Alex Elder
2025-05-15 14:23   ` Siddarth Gundu

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=20250514182015.163117-1-siddarthsgml@gmail.com \
    --to=siddarthsgml@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dongsheng.yang@easystack.cn \
    --cc=idryomov@gmail.com \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@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