diff mbox series

[resend] uvc: strncpy -> strscpy

Message ID 4ecb8867-6678-aa1a-3d86-65f815d34f5b@xs4all.nl
State Accepted
Commit 063b811f34650bf88e24998eb9c094607cb3b53e
Headers show
Series [resend] uvc: strncpy -> strscpy | expand

Commit Message

Hans Verkuil Feb. 1, 2021, 8:40 a.m. UTC
The use of strncpy is discouraged, use strscpy instead.

Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
---

Comments

Laurent Pinchart Feb. 4, 2021, 3:26 p.m. UTC | #1
Hi Hans,

Thank you for the patch.

On Mon, Feb 01, 2021 at 09:40:56AM +0100, Hans Verkuil wrote:
> The use of strncpy is discouraged, use strscpy instead.

> 

> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>


Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>


Please feel free to pick this patch for your fixes pull request as I
have no other pending UVC patches.

> ---

> diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c

> index 1abc122a0977..30ef2a3110f7 100644

> --- a/drivers/media/usb/uvc/uvc_driver.c

> +++ b/drivers/media/usb/uvc/uvc_driver.c

> @@ -1553,7 +1553,7 @@ static int uvc_gpio_parse(struct uvc_device *dev)

>  	unit->gpio.bmControls[0] = 1;

>  	unit->get_cur = uvc_gpio_get_cur;

>  	unit->get_info = uvc_gpio_get_info;

> -	strncpy(unit->name, "GPIO", sizeof(unit->name) - 1);

> +	strscpy(unit->name, "GPIO", sizeof(unit->name));

> 

>  	list_add_tail(&unit->list, &dev->entities);

> 


-- 
Regards,

Laurent Pinchart
diff mbox series

Patch

diff --git a/drivers/media/usb/uvc/uvc_driver.c b/drivers/media/usb/uvc/uvc_driver.c
index 1abc122a0977..30ef2a3110f7 100644
--- a/drivers/media/usb/uvc/uvc_driver.c
+++ b/drivers/media/usb/uvc/uvc_driver.c
@@ -1553,7 +1553,7 @@  static int uvc_gpio_parse(struct uvc_device *dev)
 	unit->gpio.bmControls[0] = 1;
 	unit->get_cur = uvc_gpio_get_cur;
 	unit->get_info = uvc_gpio_get_info;
-	strncpy(unit->name, "GPIO", sizeof(unit->name) - 1);
+	strscpy(unit->name, "GPIO", sizeof(unit->name));

 	list_add_tail(&unit->list, &dev->entities);