* [dpdk-stable] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
@ 2018-11-01 13:19 Ferruh Yigit
2018-11-01 12:49 ` [dpdk-stable] [dpdk-dev] " Shreyansh Jain
` (3 more replies)
0 siblings, 4 replies; 10+ messages in thread
From: Ferruh Yigit @ 2018-11-01 13:19 UTC (permalink / raw)
To: Thomas Monjalon, Hemant Agrawal, Shreyansh Jain; +Cc: dev, Ferruh Yigit, stable
build error:
In function ‘fman_if_init’,
.../drivers/bus/dpaa/base/fman/fman.c:186:2:
error: ‘strncpy’ output may be truncated copying 4095 bytes from a
string of length 4095 [-Werror=stringop-truncation]
strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
strncpy may result a not null-terminated string,
replaced it with rte_strscpy
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
drivers/bus/dpaa/base/fman/fman.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index bdb700423..ddcd7d1f3 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -13,6 +13,7 @@
#include <fman.h>
#include <of.h>
#include <rte_dpaa_logs.h>
+#include <rte_string_fns.h>
#define QMI_PORT_REGS_OFFSET 0x400
@@ -183,7 +184,7 @@ fman_if_init(const struct device_node *dpa_node)
}
memset(__if, 0, sizeof(*__if));
INIT_LIST_HEAD(&__if->__if.bpool_list);
- strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
+ rte_strscpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
__if->node_path[PATH_MAX - 1] = '\0';
/* Obtain the MAC node used by this interface except macless */
--
2.17.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
2018-11-01 13:19 [dpdk-stable] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0 Ferruh Yigit
@ 2018-11-01 12:49 ` Shreyansh Jain
2018-11-01 13:19 ` [dpdk-stable] [PATCH 2/2] eal: " Ferruh Yigit
` (2 subsequent siblings)
3 siblings, 0 replies; 10+ messages in thread
From: Shreyansh Jain @ 2018-11-01 12:49 UTC (permalink / raw)
To: Ferruh Yigit, Thomas Monjalon; +Cc: Hemant Agrawal, dev, stable
On Thursday 01 November 2018 06:49 PM, Ferruh Yigit wrote:
> build error:
> In function ‘fman_if_init’,
> .../drivers/bus/dpaa/base/fman/fman.c:186:2:
> error: ‘strncpy’ output may be truncated copying 4095 bytes from a
> string of length 4095 [-Werror=stringop-truncation]
> strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
>
> strncpy may result a not null-terminated string,
> replaced it with rte_strscpy
>
> Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> ---
I don't have gcc 9.0 environment to verify this, but the fix looks
reasonable to me:
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-stable] [PATCH 2/2] eal: fix build with gcc 9.0
2018-11-01 13:19 [dpdk-stable] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0 Ferruh Yigit
2018-11-01 12:49 ` [dpdk-stable] [dpdk-dev] " Shreyansh Jain
@ 2018-11-01 13:19 ` Ferruh Yigit
2018-11-01 17:42 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: " Stephen Hemminger
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 " Ferruh Yigit
3 siblings, 0 replies; 10+ messages in thread
From: Ferruh Yigit @ 2018-11-01 13:19 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Ferruh Yigit, stable
build error:
In function ‘eal_plugin_add’,
.../lib/librte_eal/common/eal_common_options.c:225:2:
error: ‘strncpy’ output may be truncated copying 4095 bytes from a
string of length 4095 [-Werror=stringop-truncation]
strncpy(solib->name, path, PATH_MAX-1);
strncpy may result a not null-terminated string,
replaced it with rte_strscpy
Fixes: fa9cdc6f8410 ("eal: move plugin loading from linuxapp to common")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
lib/librte_eal/common/eal_common_options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index b82f3ddd1..41e546b24 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -222,7 +222,7 @@ eal_plugin_add(const char *path)
return -1;
}
memset(solib, 0, sizeof(*solib));
- strncpy(solib->name, path, PATH_MAX-1);
+ rte_strscpy(solib->name, path, PATH_MAX-1);
solib->name[PATH_MAX-1] = 0;
TAILQ_INSERT_TAIL(&solib_list, solib, next);
--
2.17.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
2018-11-01 13:19 [dpdk-stable] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0 Ferruh Yigit
2018-11-01 12:49 ` [dpdk-stable] [dpdk-dev] " Shreyansh Jain
2018-11-01 13:19 ` [dpdk-stable] [PATCH 2/2] eal: " Ferruh Yigit
@ 2018-11-01 17:42 ` Stephen Hemminger
2018-11-01 17:45 ` Bruce Richardson
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 " Ferruh Yigit
3 siblings, 1 reply; 10+ messages in thread
From: Stephen Hemminger @ 2018-11-01 17:42 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Thomas Monjalon, Hemant Agrawal, Shreyansh Jain, dev, stable
On Thu, 1 Nov 2018 13:19:50 +0000
Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> build error:
> In function ‘fman_if_init’,
> .../drivers/bus/dpaa/base/fman/fman.c:186:2:
> error: ‘strncpy’ output may be truncated copying 4095 bytes from a
> string of length 4095 [-Werror=stringop-truncation]
> strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
>
> strncpy may result a not null-terminated string,
> replaced it with rte_strscpy
>
> Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Maybe just use strlcpy instead of a DPDK specific function.
That way if Gcc gets smarter it can check that as well.
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
2018-11-01 17:42 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: " Stephen Hemminger
@ 2018-11-01 17:45 ` Bruce Richardson
2018-11-01 18:21 ` Ferruh Yigit
0 siblings, 1 reply; 10+ messages in thread
From: Bruce Richardson @ 2018-11-01 17:45 UTC (permalink / raw)
To: Stephen Hemminger
Cc: Ferruh Yigit, Thomas Monjalon, Hemant Agrawal, Shreyansh Jain,
dev, stable
On Thu, Nov 01, 2018 at 10:42:31AM -0700, Stephen Hemminger wrote:
> On Thu, 1 Nov 2018 13:19:50 +0000
> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>
> > build error:
> > In function ‘fman_if_init’,
> > .../drivers/bus/dpaa/base/fman/fman.c:186:2:
> > error: ‘strncpy’ output may be truncated copying 4095 bytes from a
> > string of length 4095 [-Werror=stringop-truncation]
> > strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
> >
> > strncpy may result a not null-terminated string,
> > replaced it with rte_strscpy
> >
> > Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>
> Maybe just use strlcpy instead of a DPDK specific function.
> That way if Gcc gets smarter it can check that as well.
+1
While I get the point of strscpy, if strlcpy is good enough for openbsd,
it's good enough for me! :-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
2018-11-01 17:45 ` Bruce Richardson
@ 2018-11-01 18:21 ` Ferruh Yigit
2018-11-01 19:45 ` Thomas Monjalon
0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2018-11-01 18:21 UTC (permalink / raw)
To: Bruce Richardson, Stephen Hemminger
Cc: Thomas Monjalon, Hemant Agrawal, Shreyansh Jain, dev, stable
On 11/1/2018 5:45 PM, Bruce Richardson wrote:
> On Thu, Nov 01, 2018 at 10:42:31AM -0700, Stephen Hemminger wrote:
>> On Thu, 1 Nov 2018 13:19:50 +0000
>> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
>>
>>> build error:
>>> In function ‘fman_if_init’,
>>> .../drivers/bus/dpaa/base/fman/fman.c:186:2:
>>> error: ‘strncpy’ output may be truncated copying 4095 bytes from a
>>> string of length 4095 [-Werror=stringop-truncation]
>>> strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
>>>
>>> strncpy may result a not null-terminated string,
>>> replaced it with rte_strscpy
>>>
>>> Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
>>> Cc: stable@dpdk.org
>>>
>>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
>>
>> Maybe just use strlcpy instead of a DPDK specific function.
>> That way if Gcc gets smarter it can check that as well.
>
> +1
> While I get the point of strscpy, if strlcpy is good enough for openbsd,
> it's good enough for me! :-)
I prefer strscpy but for both cases return value is not checked at all, so makes
hard to argue the benefit of the more proper return value J
So, as a rule of thumb are we saying strlcpy is dpdk preferred copy function?
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0
2018-11-01 18:21 ` Ferruh Yigit
@ 2018-11-01 19:45 ` Thomas Monjalon
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2018-11-01 19:45 UTC (permalink / raw)
To: Ferruh Yigit
Cc: Bruce Richardson, Stephen Hemminger, Hemant Agrawal,
Shreyansh Jain, dev, stable
01/11/2018 19:21, Ferruh Yigit:
> On 11/1/2018 5:45 PM, Bruce Richardson wrote:
> > On Thu, Nov 01, 2018 at 10:42:31AM -0700, Stephen Hemminger wrote:
> >> On Thu, 1 Nov 2018 13:19:50 +0000
> >> Ferruh Yigit <ferruh.yigit@intel.com> wrote:
> >>
> >>> build error:
> >>> In function ‘fman_if_init’,
> >>> .../drivers/bus/dpaa/base/fman/fman.c:186:2:
> >>> error: ‘strncpy’ output may be truncated copying 4095 bytes from a
> >>> string of length 4095 [-Werror=stringop-truncation]
> >>> strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
> >>>
> >>> strncpy may result a not null-terminated string,
> >>> replaced it with rte_strscpy
> >>>
> >>> Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
> >>> Cc: stable@dpdk.org
> >>>
> >>> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
> >>
> >> Maybe just use strlcpy instead of a DPDK specific function.
> >> That way if Gcc gets smarter it can check that as well.
> >
> > +1
> > While I get the point of strscpy, if strlcpy is good enough for openbsd,
> > it's good enough for me! :-)
>
> I prefer strscpy but for both cases return value is not checked at all, so makes
> hard to argue the benefit of the more proper return value J
>
> So, as a rule of thumb are we saying strlcpy is dpdk preferred copy function?
Yes
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-stable] [PATCH v2 1/2] bus/dpaa: fix build with gcc 9.0
2018-11-01 13:19 [dpdk-stable] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0 Ferruh Yigit
` (2 preceding siblings ...)
2018-11-01 17:42 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: " Stephen Hemminger
@ 2018-11-02 19:06 ` Ferruh Yigit
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 2/2] eal: " Ferruh Yigit
3 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2018-11-02 19:06 UTC (permalink / raw)
To: Thomas Monjalon, Hemant Agrawal, Shreyansh Jain; +Cc: dev, Ferruh Yigit, stable
build error:
In function ‘fman_if_init’,
.../drivers/bus/dpaa/base/fman/fman.c:186:2:
error: ‘strncpy’ output may be truncated copying 4095 bytes from a
string of length 4095 [-Werror=stringop-truncation]
strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
strncpy may result a not null-terminated string,
replaced it with strlcpy
Fixes: 5b22cf744689 ("bus/dpaa: introducing FMan configurations")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* s/rte_strscpy/strlcpy
---
drivers/bus/dpaa/base/fman/fman.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/dpaa/base/fman/fman.c b/drivers/bus/dpaa/base/fman/fman.c
index bdb700423..06762e0f4 100644
--- a/drivers/bus/dpaa/base/fman/fman.c
+++ b/drivers/bus/dpaa/base/fman/fman.c
@@ -13,6 +13,7 @@
#include <fman.h>
#include <of.h>
#include <rte_dpaa_logs.h>
+#include <rte_string_fns.h>
#define QMI_PORT_REGS_OFFSET 0x400
@@ -183,7 +184,7 @@ fman_if_init(const struct device_node *dpa_node)
}
memset(__if, 0, sizeof(*__if));
INIT_LIST_HEAD(&__if->__if.bpool_list);
- strncpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
+ strlcpy(__if->node_path, dpa_node->full_name, PATH_MAX - 1);
__if->node_path[PATH_MAX - 1] = '\0';
/* Obtain the MAC node used by this interface except macless */
--
2.17.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [dpdk-stable] [PATCH v2 2/2] eal: fix build with gcc 9.0
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 " Ferruh Yigit
@ 2018-11-02 19:06 ` Ferruh Yigit
2018-11-04 21:38 ` Thomas Monjalon
0 siblings, 1 reply; 10+ messages in thread
From: Ferruh Yigit @ 2018-11-02 19:06 UTC (permalink / raw)
To: Thomas Monjalon; +Cc: dev, Ferruh Yigit, stable
build error:
In function ‘eal_plugin_add’,
.../lib/librte_eal/common/eal_common_options.c:225:2:
error: ‘strncpy’ output may be truncated copying 4095 bytes from a
string of length 4095 [-Werror=stringop-truncation]
strncpy(solib->name, path, PATH_MAX-1);
strncpy may result a not null-terminated string,
replaced it with strlcpy
Fixes: fa9cdc6f8410 ("eal: move plugin loading from linuxapp to common")
Cc: stable@dpdk.org
Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
---
v2:
* s/rte_strscpy/strlcpy/
---
lib/librte_eal/common/eal_common_options.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/librte_eal/common/eal_common_options.c b/lib/librte_eal/common/eal_common_options.c
index b82f3ddd1..e31eca5c0 100644
--- a/lib/librte_eal/common/eal_common_options.c
+++ b/lib/librte_eal/common/eal_common_options.c
@@ -222,7 +222,7 @@ eal_plugin_add(const char *path)
return -1;
}
memset(solib, 0, sizeof(*solib));
- strncpy(solib->name, path, PATH_MAX-1);
+ strlcpy(solib->name, path, PATH_MAX-1);
solib->name[PATH_MAX-1] = 0;
TAILQ_INSERT_TAIL(&solib_list, solib, next);
--
2.17.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [dpdk-stable] [PATCH v2 2/2] eal: fix build with gcc 9.0
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 2/2] eal: " Ferruh Yigit
@ 2018-11-04 21:38 ` Thomas Monjalon
0 siblings, 0 replies; 10+ messages in thread
From: Thomas Monjalon @ 2018-11-04 21:38 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: stable, dev
02/11/2018 20:06, Ferruh Yigit:
> build error:
> In function ‘eal_plugin_add’,
> .../lib/librte_eal/common/eal_common_options.c:225:2:
> error: ‘strncpy’ output may be truncated copying 4095 bytes from a
> string of length 4095 [-Werror=stringop-truncation]
> strncpy(solib->name, path, PATH_MAX-1);
>
> strncpy may result a not null-terminated string,
> replaced it with strlcpy
>
> Fixes: fa9cdc6f8410 ("eal: move plugin loading from linuxapp to common")
> Cc: stable@dpdk.org
>
> Signed-off-by: Ferruh Yigit <ferruh.yigit@intel.com>
Series applied, thanks
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2018-11-04 21:39 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-01 13:19 [dpdk-stable] [PATCH 1/2] bus/dpaa: fix build with gcc 9.0 Ferruh Yigit
2018-11-01 12:49 ` [dpdk-stable] [dpdk-dev] " Shreyansh Jain
2018-11-01 13:19 ` [dpdk-stable] [PATCH 2/2] eal: " Ferruh Yigit
2018-11-01 17:42 ` [dpdk-stable] [dpdk-dev] [PATCH 1/2] bus/dpaa: " Stephen Hemminger
2018-11-01 17:45 ` Bruce Richardson
2018-11-01 18:21 ` Ferruh Yigit
2018-11-01 19:45 ` Thomas Monjalon
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 " Ferruh Yigit
2018-11-02 19:06 ` [dpdk-stable] [PATCH v2 2/2] eal: " Ferruh Yigit
2018-11-04 21:38 ` 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).