Re: [PATCH] net/smc: replace strncpy with strscpy for ib_name

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

 



On 10/09/25 3:31 pm, Leon Romanovsky wrote:
>> --- a/net/smc/smc_pnet.c
>> +++ b/net/smc/smc_pnet.c
>> @@ -450,7 +450,7 @@ static int smc_pnet_add_ib(struct smc_pnettable *pnettable, char *ib_name,
>>  		return -ENOMEM;
>>  	new_pe->type = SMC_PNET_IB;
>>  	memcpy(new_pe->pnet_name, pnet_name, SMC_MAX_PNETID_LEN);
>> -	strncpy(new_pe->ib_name, ib_name, IB_DEVICE_NAME_MAX);
>> +	strscpy(new_pe->ib_name, ib_name);
> 
> It is worth to mention that caching ib_name is wrong as IB/core provides
> IB device rename functionality.

In our case we hit this code path where we pass *PCI_ID*
as the *ib_name* using *smc_pnet* tool(smc_pnet -a <pnet_name> -D
<PCI_ID>). I believe PCI_ID will not change, so caching it here is fine.




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux