Re: [PATCH] staging: vme_user: Replace strcpy with strscpy
From: Greg KH
Date: Sun Sep 17 2023 - 12:34:46 EST
On Sun, Sep 17, 2023 at 05:43:02PM +0200, Jonathan Bergh wrote:
> Replace strcpy with strscpy as preferred by checkpatch in vme_fake.c to
> prevent warnings.
>
> Signed-off-by: Jonathan Bergh <bergh.jonathan@xxxxxxxxx>
> ---
> drivers/staging/vme_user/vme_fake.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/staging/vme_user/vme_fake.c b/drivers/staging/vme_user/vme_fake.c
> index 9bcb89a84d53..0cf5700e151f 100644
> --- a/drivers/staging/vme_user/vme_fake.c
> +++ b/drivers/staging/vme_user/vme_fake.c
> @@ -1093,7 +1093,7 @@ static int __init fake_init(void)
> tasklet_init(&fake_device->int_tasklet, fake_VIRQ_tasklet,
> (unsigned long) fake_bridge);
>
> - strcpy(fake_bridge->name, driver_name);
> + strscpy(fake_bridge->name, driver_name, sizeof(fake_bridge->name));
If it were this easy, we would have swept the tree and done so, right?
Are you sure this is correct? If so, please document exactly why it is
correct in the changelog text when you resend this.
thanks,
greg k-h