[Drbd-dev] [PATCH] block: move from strlcpy with unused retval to strscpy
Geoff Levand
geoff at infradead.org
Fri Aug 19 17:21:56 CEST 2022
On 8/18/22 13:59, Wolfram Sang wrote:
> 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>
> ---
...
> diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
> index e1d080f680ed..c76e0148eada 100644
> --- a/drivers/block/ps3vram.c
> +++ b/drivers/block/ps3vram.c
> @@ -745,7 +745,7 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev)
> gendisk->flags |= GENHD_FL_NO_PART;
> gendisk->fops = &ps3vram_fops;
> gendisk->private_data = dev;
> - strlcpy(gendisk->disk_name, DEVICE_NAME, sizeof(gendisk->disk_name));
> + strscpy(gendisk->disk_name, DEVICE_NAME, sizeof(gendisk->disk_name));
> set_capacity(gendisk, priv->size >> 9);
> blk_queue_max_segments(gendisk->queue, BLK_MAX_SEGMENTS);
> blk_queue_max_segment_size(gendisk->queue, BLK_MAX_SEGMENT_SIZE);
Seems OK for ps3vram.
Acked-by: Geoff Levand <geoff at infradead.org>
More information about the drbd-dev
mailing list