[PATCH 01/11] staging: vc04_services: changen strncpy() to strscpy_pad()

Dan Carpenter dan.carpenter at linaro.org
Thu Mar 28 07:42:25 PDT 2024


On Thu, Mar 28, 2024 at 03:04:45PM +0100, Arnd Bergmann wrote:
> diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> index 258aa0e37f55..6ca5797aeae5 100644
> --- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> +++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
> @@ -937,8 +937,8 @@ static int create_component(struct vchiq_mmal_instance *instance,
>  	/* build component create message */
>  	m.h.type = MMAL_MSG_TYPE_COMPONENT_CREATE;
>  	m.u.component_create.client_component = component->client_component;
> -	strncpy(m.u.component_create.name, name,
> -		sizeof(m.u.component_create.name));
> +	strscpy_pad(m.u.component_create.name, name,
> +		    sizeof(m.u.component_create.name));

You sent this earlier and we already applied it.

Btw, I just learned there is a new trick to write this when it's just
sizeof(dest).

	strscpy_pad(m.u.component_create.name, name);

regards,
dan carpenter




More information about the linux-rpi-kernel mailing list