* [dpdk-dev] [PATCH] kni: fix build with gcc 8.1
@ 2018-06-19 12:08 Ferruh Yigit
2018-06-19 23:35 ` Stephen Hemminger
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-19 12:08 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, stable
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@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
kernel/linux/kni/ethtool/igb/igb.h | 2 +-
kernel/linux/kni/ethtool/igb/igb_ethtool.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/kernel/linux/kni/ethtool/igb/igb.h b/kernel/linux/kni/ethtool/igb/igb.h
index 8aa2a3088..5e798ae83 100644
--- a/kernel/linux/kni/ethtool/igb/igb.h
+++ b/kernel/linux/kni/ethtool/igb/igb.h
@@ -592,7 +592,7 @@ struct igb_adapter {
int int_mode;
u32 rss_queues;
u32 vmdq_pools;
- char fw_version[43];
+ char fw_version[32];
u32 wvbr;
struct igb_mac_addr *mac_table;
#ifdef CONFIG_IGB_VMDQ_NETDEV
diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
index 064528bcf..0b8b25ff1 100644
--- 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);
drvinfo->n_stats = IGB_STATS_LEN;
drvinfo->testinfo_len = IGB_TEST_LEN;
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH] kni: fix build with gcc 8.1
2018-06-19 12:08 [dpdk-dev] [PATCH] kni: fix build with gcc 8.1 Ferruh Yigit
@ 2018-06-19 23:35 ` Stephen Hemminger
2018-06-20 16:39 ` Ferruh Yigit
2018-06-20 9:01 ` [dpdk-dev] [dpdk-stable] " De Lara Guarch, Pablo
2018-06-26 9:02 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2 siblings, 1 reply; 11+ messages in thread
From: Stephen Hemminger @ 2018-06-19 23:35 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, stable
On Tue, 19 Jun 2018 13:08:55 +0100
Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> 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@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
> kernel/linux/kni/ethtool/igb/igb.h | 2 +-
> kernel/linux/kni/ethtool/igb/igb_ethtool.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/linux/kni/ethtool/igb/igb.h b/kernel/linux/kni/ethtool/igb/igb.h
> index 8aa2a3088..5e798ae83 100644
> --- a/kernel/linux/kni/ethtool/igb/igb.h
> +++ b/kernel/linux/kni/ethtool/igb/igb.h
> @@ -592,7 +592,7 @@ struct igb_adapter {
> int int_mode;
> u32 rss_queues;
> u32 vmdq_pools;
> - char fw_version[43];
> + char fw_version[32];
Use ETHTOOL_FWVERS_LEN?
> u32 wvbr;
> struct igb_mac_addr *mac_table;
> #ifdef CONFIG_IGB_VMDQ_NETDEV
> diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
> index 064528bcf..0b8b25ff1 100644
> --- 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));
Why not:
strlcpy(drvinfo->fw_version, adapter->fw_version,
sizeof(drvinfo->fw_version));
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] kni: fix build with gcc 8.1
2018-06-19 12:08 [dpdk-dev] [PATCH] kni: fix build with gcc 8.1 Ferruh Yigit
2018-06-19 23:35 ` Stephen Hemminger
@ 2018-06-20 9:01 ` De Lara Guarch, Pablo
2018-06-20 16:40 ` Ferruh Yigit
2018-06-26 9:02 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2 siblings, 1 reply; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2018-06-20 9:01 UTC (permalink / raw)
To: Yigit, Ferruh, Yigit, Ferruh; +Cc: dev, stable
> -----Original Message-----
> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Ferruh Yigit
> Sent: Tuesday, June 19, 2018 1:09 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; stable@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@dpdk.org
>
Fixes line?
> Signed-off-by: Ferruh Yigit <ferruh.yigit@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
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH] kni: fix build with gcc 8.1
2018-06-19 23:35 ` Stephen Hemminger
@ 2018-06-20 16:39 ` Ferruh Yigit
2018-06-20 17:04 ` Ferruh Yigit
0 siblings, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-20 16:39 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, stable
On 6/20/2018 12:35 AM, Stephen Hemminger wrote:
> On Tue, 19 Jun 2018 13:08:55 +0100
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
>> 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@dpdk.org
>>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>> ---
>> kernel/linux/kni/ethtool/igb/igb.h | 2 +-
>> kernel/linux/kni/ethtool/igb/igb_ethtool.c | 2 +-
>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/kernel/linux/kni/ethtool/igb/igb.h b/kernel/linux/kni/ethtool/igb/igb.h
>> index 8aa2a3088..5e798ae83 100644
>> --- a/kernel/linux/kni/ethtool/igb/igb.h
>> +++ b/kernel/linux/kni/ethtool/igb/igb.h
>> @@ -592,7 +592,7 @@ struct igb_adapter {
>> int int_mode;
>> u32 rss_queues;
>> u32 vmdq_pools;
>> - char fw_version[43];
>> + char fw_version[32];
>
> Use ETHTOOL_FWVERS_LEN?
Yes, that is what drvinfo->fw_version uses, and it seems it has been around
enough to not cause any build issue, will use that one.
>
>> u32 wvbr;
>> struct igb_mac_addr *mac_table;
>> #ifdef CONFIG_IGB_VMDQ_NETDEV
>> diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
>> index 064528bcf..0b8b25ff1 100644
>> --- 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));
>
> Why not:
> strlcpy(drvinfo->fw_version, adapter->fw_version,
> sizeof(drvinfo->fw_version));
Just to be cautious about changing API, to not have any problem with older
version of kernels.
But it seems strlcpy supported long enough to not cause an issue, I will use it.
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH] kni: fix build with gcc 8.1
2018-06-20 9:01 ` [dpdk-dev] [dpdk-stable] " De Lara Guarch, Pablo
@ 2018-06-20 16:40 ` Ferruh Yigit
0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-20 16:40 UTC (permalink / raw)
To: De Lara Guarch, Pablo; +Cc: dev, stable
On 6/20/2018 10:01 AM, De Lara Guarch, Pablo wrote:
>
>
>> -----Original Message-----
>> From: stable [mailto:stable-bounces@dpdk.org] On Behalf Of Ferruh Yigit
>> Sent: Tuesday, June 19, 2018 1:09 PM
>> To: Yigit, Ferruh <ferruh.yigit@intel.com>
>> Cc: dev@dpdk.org; stable@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@dpdk.org
>>
>
> Fixes line?
I will add.
>
>> Signed-off-by: Ferruh Yigit <ferruh.yigit@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
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH] kni: fix build with gcc 8.1
2018-06-20 16:39 ` Ferruh Yigit
@ 2018-06-20 17:04 ` Ferruh Yigit
0 siblings, 0 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-20 17:04 UTC (permalink / raw)
To: Stephen Hemminger; +Cc: dev, stable
On 6/20/2018 5:39 PM, Ferruh Yigit wrote:
> On 6/20/2018 12:35 AM, Stephen Hemminger wrote:
>> On Tue, 19 Jun 2018 13:08:55 +0100
>> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>>> 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@dpdk.org
>>>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>>> ---
>>> kernel/linux/kni/ethtool/igb/igb.h | 2 +-
>>> kernel/linux/kni/ethtool/igb/igb_ethtool.c | 2 +-
>>> 2 files changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/kernel/linux/kni/ethtool/igb/igb.h b/kernel/linux/kni/ethtool/igb/igb.h
>>> index 8aa2a3088..5e798ae83 100644
>>> --- a/kernel/linux/kni/ethtool/igb/igb.h
>>> +++ b/kernel/linux/kni/ethtool/igb/igb.h
>>> @@ -592,7 +592,7 @@ struct igb_adapter {
>>> int int_mode;
>>> u32 rss_queues;
>>> u32 vmdq_pools;
>>> - char fw_version[43];
>>> + char fw_version[32];
>>
>> Use ETHTOOL_FWVERS_LEN?
>
> Yes, that is what drvinfo->fw_version uses, and it seems it has been around
> enough to not cause any build issue, will use that one.
Ah so much fun, it has been updated to 43 by me in the past, to prevent another
warning [1] which another part of code has potential to write larger string to
fw_version.
Reducing value back to 32 may bring back that old warning ...
[1]
Fixes: c3698192940c ("kni: fix build with gcc 7.1")
>
>>
>>> u32 wvbr;
>>> struct igb_mac_addr *mac_table;
>>> #ifdef CONFIG_IGB_VMDQ_NETDEV
>>> diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
>>> index 064528bcf..0b8b25ff1 100644
>>> --- 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));
>>
>> Why not:
>> strlcpy(drvinfo->fw_version, adapter->fw_version,
>> sizeof(drvinfo->fw_version));
>
> Just to be cautious about changing API, to not have any problem with older
> version of kernels.
> But it seems strlcpy supported long enough to not cause an issue, I will use it.
>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v2] kni: fix build with gcc 8.1
2018-06-19 12:08 [dpdk-dev] [PATCH] kni: fix build with gcc 8.1 Ferruh Yigit
2018-06-19 23:35 ` Stephen Hemminger
2018-06-20 9:01 ` [dpdk-dev] [dpdk-stable] " De Lara Guarch, Pablo
@ 2018-06-26 9:02 ` Ferruh Yigit
2018-06-26 9:54 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-06-26 11:38 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2 siblings, 2 replies; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-26 9:02 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, stephen, pablo.de.lara.guarch, stable
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 using strlcpy instead of strncpy.
adapter->fw_version size kept same because of
c3698192940c ("kni: fix build with gcc 7.1")
Also next line strncpy usage replaced with strlcpy while arround.
Fixes: c3698192940c ("kni: fix build with gcc 7.1")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* used strlcpy instead of strncpy
* Updated strncpy usage in next line to strlcpy too
* Added fixes line
---
kernel/linux/kni/ethtool/igb/igb_ethtool.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
index 064528bcf..002f75c48 100644
--- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
+++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
@@ -811,9 +811,10 @@ static void igb_get_drvinfo(struct net_device *netdev,
strncpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver) - 1);
strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) - 1);
- strncpy(drvinfo->fw_version, adapter->fw_version,
- sizeof(drvinfo->fw_version) - 1);
- strncpy(drvinfo->bus_info, pci_name(adapter->pdev), sizeof(drvinfo->bus_info) -1);
+ strlcpy(drvinfo->fw_version, adapter->fw_version,
+ sizeof(drvinfo->fw_version));
+ strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
+ sizeof(drvinfo->bus_info));
drvinfo->n_stats = IGB_STATS_LEN;
drvinfo->testinfo_len = IGB_TEST_LEN;
drvinfo->regdump_len = igb_get_regs_len(netdev);
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v2] kni: fix build with gcc 8.1
2018-06-26 9:02 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
@ 2018-06-26 9:54 ` Thomas Monjalon
2018-06-26 11:38 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
1 sibling, 0 replies; 11+ messages in thread
From: Thomas Monjalon @ 2018-06-26 9:54 UTC (permalink / raw)
To: stable; +Cc: Ferruh Yigit, dev, stephen, pablo.de.lara.guarch
26/06/2018 11:02, Ferruh Yigit:
> --- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
> +++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
> @@ -811,9 +811,10 @@ static void igb_get_drvinfo(struct net_device *netdev,
> strncpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver) - 1);
> strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) - 1);
> - strncpy(drvinfo->fw_version, adapter->fw_version,
> - sizeof(drvinfo->fw_version) - 1);
There is a leading space before the minus of first line.
^ permalink raw reply [flat|nested] 11+ messages in thread
* [dpdk-dev] [PATCH v3] kni: fix build with gcc 8.1
2018-06-26 9:02 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2018-06-26 9:54 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
@ 2018-06-26 11:38 ` Ferruh Yigit
2018-06-26 13:43 ` De Lara Guarch, Pablo
1 sibling, 1 reply; 11+ messages in thread
From: Ferruh Yigit @ 2018-06-26 11:38 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: dev, stephen, pablo.de.lara.guarch, stable
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 using strlcpy instead of strncpy.
adapter->fw_version size kept same because of
c3698192940c ("kni: fix build with gcc 7.1")
Also next line strncpy usage replaced with strlcpy while arround.
Fixes: c3698192940c ("kni: fix build with gcc 7.1")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* used strlcpy instead of strncpy
* Updated strncpy usage in next line to strlcpy too
* Added fixes line
v3:
* fix patch syntax corrupted during send
---
kernel/linux/kni/ethtool/igb/igb_ethtool.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/kernel/linux/kni/ethtool/igb/igb_ethtool.c b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
index 064528bcf..002f75c48 100644
--- a/kernel/linux/kni/ethtool/igb/igb_ethtool.c
+++ b/kernel/linux/kni/ethtool/igb/igb_ethtool.c
@@ -811,9 +811,10 @@ static void igb_get_drvinfo(struct net_device *netdev,
strncpy(drvinfo->driver, igb_driver_name, sizeof(drvinfo->driver) - 1);
strncpy(drvinfo->version, igb_driver_version, sizeof(drvinfo->version) - 1);
- strncpy(drvinfo->fw_version, adapter->fw_version,
- sizeof(drvinfo->fw_version) - 1);
- strncpy(drvinfo->bus_info, pci_name(adapter->pdev), sizeof(drvinfo->bus_info) -1);
+ strlcpy(drvinfo->fw_version, adapter->fw_version,
+ sizeof(drvinfo->fw_version));
+ strlcpy(drvinfo->bus_info, pci_name(adapter->pdev),
+ sizeof(drvinfo->bus_info));
drvinfo->n_stats = IGB_STATS_LEN;
drvinfo->testinfo_len = IGB_TEST_LEN;
drvinfo->regdump_len = igb_get_regs_len(netdev);
--
2.17.1
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [PATCH v3] kni: fix build with gcc 8.1
2018-06-26 11:38 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
@ 2018-06-26 13:43 ` De Lara Guarch, Pablo
2018-06-27 13:15 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
0 siblings, 1 reply; 11+ messages in thread
From: De Lara Guarch, Pablo @ 2018-06-26 13:43 UTC (permalink / raw)
To: Yigit, Ferruh; +Cc: dev, stephen, stable
> -----Original Message-----
> From: Yigit, Ferruh
> Sent: Tuesday, June 26, 2018 12:38 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>
> Cc: dev@dpdk.org; stephen@networkplumber.org; De Lara Guarch, Pablo
> <pablo.de.lara.guarch@intel.com>; stable@dpdk.org
> Subject: [PATCH v3] 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 using strlcpy instead of strncpy.
>
> adapter->fw_version size kept same because of
> c3698192940c ("kni: fix build with gcc 7.1")
>
> Also next line strncpy usage replaced with strlcpy while arround.
>
> Fixes: c3698192940c ("kni: fix build with gcc 7.1")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [dpdk-dev] [dpdk-stable] [PATCH v3] kni: fix build with gcc 8.1
2018-06-26 13:43 ` De Lara Guarch, Pablo
@ 2018-06-27 13:15 ` Thomas Monjalon
0 siblings, 0 replies; 11+ messages in thread
From: Thomas Monjalon @ 2018-06-27 13:15 UTC (permalink / raw)
To: Yigit, Ferruh; +Cc: stable, De Lara Guarch, Pablo, dev, stephen
26/06/2018 15:43, De Lara Guarch, Pablo:
>
> > 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 using strlcpy instead of strncpy.
> >
> > adapter->fw_version size kept same because of
> > c3698192940c ("kni: fix build with gcc 7.1")
> >
> > Also next line strncpy usage replaced with strlcpy while arround.
> >
> > Fixes: c3698192940c ("kni: fix build with gcc 7.1")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Acked-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
Applied, thanks
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2018-06-27 13:15 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19 12:08 [dpdk-dev] [PATCH] kni: fix build with gcc 8.1 Ferruh Yigit
2018-06-19 23:35 ` Stephen Hemminger
2018-06-20 16:39 ` Ferruh Yigit
2018-06-20 17:04 ` Ferruh Yigit
2018-06-20 9:01 ` [dpdk-dev] [dpdk-stable] " De Lara Guarch, Pablo
2018-06-20 16:40 ` Ferruh Yigit
2018-06-26 9:02 ` [dpdk-dev] [PATCH v2] " Ferruh Yigit
2018-06-26 9:54 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
2018-06-26 11:38 ` [dpdk-dev] [PATCH v3] " Ferruh Yigit
2018-06-26 13:43 ` De Lara Guarch, Pablo
2018-06-27 13:15 ` [dpdk-dev] [dpdk-stable] " Thomas Monjalon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).