Thread (3 messages) 3 messages, 3 authors, 2022-08-19

Re: [PATCH] block: move from strlcpy with unused retval to strscpy

From: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
Date: 2022-08-19 15:24:58
Also in: linuxppc-dev, lkml

Am 18.08.22 um 22:59 schrieb Wolfram Sang:
Follow the advice of the below link and prefer 'strscpy' in this
subsystem. Conversion is 1:1 because the return value is not used.
Generated by a coccinelle script.

Link: https://lore.kernel.org/r/CAHk-=wgfRnXz0W3D37d01q3JFkr_i_uTL=V6A6G1oUZcprmknw@mail.gmail.com/ (local)
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/block/brd.c               |  2 +-
 drivers/block/drbd/drbd_nl.c      |  2 +-
For the drbd part:

Acked-by: Christoph Böhmwalder <christoph.boehmwalder@linbit.com>
 drivers/block/mtip32xx/mtip32xx.c | 12 ++++++------
 drivers/block/ps3vram.c           |  2 +-
 drivers/block/zram/zram_drv.c     |  6 +++---
 5 files changed, 12 insertions(+), 12 deletions(-)
...
quoted hunk ↗ jump to hunk
diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c
index 013d355a2033..864c98e74875 100644
--- a/drivers/block/drbd/drbd_nl.c
+++ b/drivers/block/drbd/drbd_nl.c
@@ -4752,7 +4752,7 @@ void notify_helper(enum drbd_notification_type type,
 	struct drbd_genlmsghdr *dh;
 	int err;
 
-	strlcpy(helper_info.helper_name, name, sizeof(helper_info.helper_name));
+	strscpy(helper_info.helper_name, name, sizeof(helper_info.helper_name));
 	helper_info.helper_name_len = min(strlen(name), sizeof(helper_info.helper_name));
 	helper_info.helper_status = status;
-- 
Christoph Böhmwalder
LINBIT | Keeping the Digital World Running
DRBD HA —  Disaster Recovery — Software defined Storage
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help