* [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy
@ 2020-10-07 9:20 Ciara Loftus
2020-10-07 9:35 ` [dpdk-dev] [PATCH v3] net/af_xdp: use rte_strscpy " Ciara Loftus
2020-10-07 10:29 ` [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy " Bruce Richardson
0 siblings, 2 replies; 5+ messages in thread
From: Ciara Loftus @ 2020-10-07 9:20 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus
strncpy may leave the destination buffer not NULL terminated so use
strlcpy instead.
Coverity issue: 362975
Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
v2:
* use strlcpy instead of snprintf
drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index eaf2c9c873..ac00cbab8e 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
channels.cmd = ETHTOOL_GCHANNELS;
ifr.ifr_data = (void *)&channels;
- strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
ret = ioctl(fd, SIOCETHTOOL, &ifr);
if (ret) {
if (errno == EOPNOTSUPP) {
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v3] net/af_xdp: use rte_strscpy instead of strncpy
2020-10-07 9:20 [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy Ciara Loftus
@ 2020-10-07 9:35 ` Ciara Loftus
2020-10-07 9:38 ` [dpdk-dev] [PATCH v4] " Ciara Loftus
2020-10-07 10:29 ` [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy " Bruce Richardson
1 sibling, 1 reply; 5+ messages in thread
From: Ciara Loftus @ 2020-10-07 9:35 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus
strncpy may leave the destination buffer not NULL terminated so use
rte_strscpy instead.
Coverity issue: 362975
Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
v3:
* use rte_strscpy instead of strlcpy
v2:
* use strlcpy instead of snprintf
drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index eaf2c9c873..ac00cbab8e 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
channels.cmd = ETHTOOL_GCHANNELS;
ifr.ifr_data = (void *)&channels;
- strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
ret = ioctl(fd, SIOCETHTOOL, &ifr);
if (ret) {
if (errno == EOPNOTSUPP) {
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [dpdk-dev] [PATCH v4] net/af_xdp: use rte_strscpy instead of strncpy
2020-10-07 9:35 ` [dpdk-dev] [PATCH v3] net/af_xdp: use rte_strscpy " Ciara Loftus
@ 2020-10-07 9:38 ` Ciara Loftus
0 siblings, 0 replies; 5+ messages in thread
From: Ciara Loftus @ 2020-10-07 9:38 UTC (permalink / raw)
To: dev; +Cc: Ciara Loftus
strncpy may leave the destination buffer not NULL terminated so use
rte_strscpy instead.
Coverity issue: 362975
Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
---
v4:
* actually use rte_strscpy instead of strlcpy
v3:
* use rte_strscpy instead of strlcpy
v2:
* use strlcpy instead of snprintf
drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index eaf2c9c873..f394c57a74 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
channels.cmd = ETHTOOL_GCHANNELS;
ifr.ifr_data = (void *)&channels;
- strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
+ rte_strscpy(ifr.ifr_name, if_name, IFNAMSIZ);
ret = ioctl(fd, SIOCETHTOOL, &ifr);
if (ret) {
if (errno == EOPNOTSUPP) {
--
2.17.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy
2020-10-07 9:20 [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy Ciara Loftus
2020-10-07 9:35 ` [dpdk-dev] [PATCH v3] net/af_xdp: use rte_strscpy " Ciara Loftus
@ 2020-10-07 10:29 ` Bruce Richardson
2020-10-09 16:31 ` Ferruh Yigit
1 sibling, 1 reply; 5+ messages in thread
From: Bruce Richardson @ 2020-10-07 10:29 UTC (permalink / raw)
To: Ciara Loftus; +Cc: dev
On Wed, Oct 07, 2020 at 09:20:50AM +0000, Ciara Loftus wrote:
> strncpy may leave the destination buffer not NULL terminated so use
> strlcpy instead.
>
> Coverity issue: 362975
> Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
If the community prefers using rte_strscpy, this ack can also apply to v4
too. :-)
> v2:
> * use strlcpy instead of snprintf
>
> drivers/net/af_xdp/rte_eth_af_xdp.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
> index eaf2c9c873..ac00cbab8e 100644
> --- a/drivers/net/af_xdp/rte_eth_af_xdp.c
> +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
> @@ -1362,7 +1362,7 @@ xdp_get_channels_info(const char *if_name, int *max_queues,
>
> channels.cmd = ETHTOOL_GCHANNELS;
> ifr.ifr_data = (void *)&channels;
> - strncpy(ifr.ifr_name, if_name, IFNAMSIZ);
> + strlcpy(ifr.ifr_name, if_name, IFNAMSIZ);
> ret = ioctl(fd, SIOCETHTOOL, &ifr);
> if (ret) {
> if (errno == EOPNOTSUPP) {
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy
2020-10-07 10:29 ` [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy " Bruce Richardson
@ 2020-10-09 16:31 ` Ferruh Yigit
0 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2020-10-09 16:31 UTC (permalink / raw)
To: Bruce Richardson, Ciara Loftus; +Cc: dev
On 10/7/2020 11:29 AM, Bruce Richardson wrote:
> On Wed, Oct 07, 2020 at 09:20:50AM +0000, Ciara Loftus wrote:
>> strncpy may leave the destination buffer not NULL terminated so use
>> strlcpy instead.
>>
>> Coverity issue: 362975
>> Fixes: 339b88c6a91f ("net/af_xdp: support multi-queue")
>> Signed-off-by: Ciara Loftus <ciara.loftus@intel.com>
>> ---
>
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>
>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
Applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2020-10-09 16:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-07 9:20 [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy instead of strncpy Ciara Loftus
2020-10-07 9:35 ` [dpdk-dev] [PATCH v3] net/af_xdp: use rte_strscpy " Ciara Loftus
2020-10-07 9:38 ` [dpdk-dev] [PATCH v4] " Ciara Loftus
2020-10-07 10:29 ` [dpdk-dev] [PATCH v2] net/af_xdp: use strlcpy " Bruce Richardson
2020-10-09 16:31 ` Ferruh Yigit
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).