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

Christoph Böhmwalder christoph.boehmwalder at linbit.com
Sat Aug 20 01:24:50 AEST 2022


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/
> Signed-off-by: Wolfram Sang <wsa+renesas at 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 at 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(-)
...
> 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


More information about the Linuxppc-dev mailing list