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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 28, 2024, at 15:42, Dan Carpenter wrote:
> 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.

Sorry about that. I normally mark patches I send as applied
in the subject but it looks like I lost the annotation
by accident.

> 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);

Ah, cute.

     arnd




[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux