[dpdk-stable] [PATCH] kni: fix build with gcc 8.1
Ferruh Yigit
ferruh.yigit at intel.com
Wed Jun 20 18:40:47 CEST 2018
On 6/20/2018 10:01 AM, De Lara Guarch, Pablo wrote:
>
>
>> -----Original Message-----
>> From: stable [mailto:stable-bounces at dpdk.org] On Behalf Of Ferruh Yigit
>> Sent: Tuesday, June 19, 2018 1:09 PM
>> To: Yigit, Ferruh <ferruh.yigit at intel.com>
>> Cc: dev at dpdk.org; stable at dpdk.org
>> Subject: [dpdk-stable] [PATCH] kni: fix build with gcc 8.1
>>
>> Error observed when CONFIG_RTE_KNI_KMOD_ETHTOOL config option is
>> enabled.
>>
>> build error:
>> In function ‘strncpy’,
>> inlined from ‘igb_get_drvinfo’ at
>> .../dpdk/build/build/kernel/linux/kni/igb_ethtool.c:814:2:
>> .../include/linux/string.h:246:9: error: ‘__builtin_strncpy’ output
>> may be truncated copying 31 bytes from a string of length 42
>> [-Werror=stringop-truncation]
>> return __builtin_strncpy(p, q, size);
>> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>
>> Fixed by reducing the adapter->fw_version size and adjusting strncpy limit size.
>>
>> Cc: stable at dpdk.org
>>
>
> Fixes line?
I will add.
>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit at intel.com>
>
> ...
>
>> --- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
>> +++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
>> @@ -812,7 +812,7 @@ static void igb_get_drvinfo(struct net_device *netdev,
>> strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) -
>> 1);
>>
>> strncpy(drvinfo->fw_version, adapter->fw_version,
>> - sizeof(drvinfo->fw_version) - 1);
>> + sizeof(drvinfo->fw_version));
>> strncpy(drvinfo->bus_info, pci_name(adapter->pdev), sizeof(drvinfo-
>>> bus_info) -1);
>
> This patch fixes the compilation issue, but should we use strlcpy instead of strncpy?
>
> Thanks,
> Pablo
>
More information about the stable
mailing list