patches for DPDK stable branches
 help / color / mirror / Atom feed
* Re: [dpdk-stable] [PATCH v9 3/5] net/virtio-user: fix devargs parsing
       [not found]     ` <20200406085855.25773-4-i.dyukov@samsung.com>
@ 2020-04-15 15:09       ` Maxime Coquelin
  0 siblings, 0 replies; 4+ messages in thread
From: Maxime Coquelin @ 2020-04-15 15:09 UTC (permalink / raw)
  To: Ivan Dyukov, dev, v.kuramshin, amorenoz, zhihong.wang, xiaolong.ye, mb
  Cc: stable



On 4/6/20 10:58 AM, Ivan Dyukov wrote:
> strtoull returns 0 if it fails to parse input string. It's ignored
> in get_integer_arg.
> 
> This patch handles error cases for strtoull function.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Cc: stable@dpdk.org

> 
> Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
> ---
>  drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
> index e61af4068..a79f68a36 100644
> --- a/drivers/net/virtio/virtio_user_ethdev.c
> +++ b/drivers/net/virtio/virtio_user_ethdev.c
> @@ -477,12 +477,17 @@ static int
>  get_integer_arg(const char *key __rte_unused,
>  		const char *value, void *extra_args)
>  {
> +	uint64_t integer = 0;
>  	if (!value || !extra_args)
>  		return -EINVAL;
> -
> -	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
> -
> -	return 0;
> +	errno = 0;
> +	integer = strtoull(value, NULL, 0);
> +	/* extra_args keeps default value, it should be replaced
> +	 * only in case of successful parsing of the 'value' arg
> +	 */
> +	if (errno == 0)
> +		*(uint64_t *)extra_args = integer;
> +	return -errno;
>  }
>  
>  static struct rte_eth_dev *
> 

I will fix the commit message when applying.

Reviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>

Thanks,
Maxime


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH v10 4/6] net/virtio-user: fix devargs parsing
       [not found]   ` <CGME20200415200445eucas1p2406d3f5b1794958c8345741c83d2000e@eucas1p2.samsung.com>
@ 2020-04-15 20:03     ` Ivan Dyukov
  0 siblings, 0 replies; 4+ messages in thread
From: Ivan Dyukov @ 2020-04-15 20:03 UTC (permalink / raw)
  To: dev, maxime.coquelin, i.dyukov, v.kuramshin, amorenoz,
	zhihong.wang, xiaolong.ye, mb
  Cc: stable

strtoull returns 0 if it fails to parse input string. It's ignored
in get_integer_arg.

This patch handles error cases for strtoull function.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Cc: stable@dpdk.org
Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index e61af4068..a79f68a36 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -477,12 +477,17 @@ static int
 get_integer_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
+	uint64_t integer = 0;
 	if (!value || !extra_args)
 		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
+	errno = 0;
+	integer = strtoull(value, NULL, 0);
+	/* extra_args keeps default value, it should be replaced
+	 * only in case of successful parsing of the 'value' arg
+	 */
+	if (errno == 0)
+		*(uint64_t *)extra_args = integer;
+	return -errno;
 }
 
 static struct rte_eth_dev *
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH v11 4/6] net/virtio-user: fix devargs parsing
       [not found]   ` <CGME20200416055330eucas1p120bee1af98e108e09dd7515faf094c73@eucas1p1.samsung.com>
@ 2020-04-16  5:53     ` Ivan Dyukov
  0 siblings, 0 replies; 4+ messages in thread
From: Ivan Dyukov @ 2020-04-16  5:53 UTC (permalink / raw)
  To: dev, maxime.coquelin, i.dyukov, v.kuramshin, amorenoz,
	zhihong.wang, xiaolong.ye, mb
  Cc: stable

strtoull returns 0 if it fails to parse input string. It's ignored
in get_integer_arg.

This patch handles error cases for strtoull function.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Cc: stable@dpdk.org
Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index e61af4068..a79f68a36 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -477,12 +477,17 @@ static int
 get_integer_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
+	uint64_t integer = 0;
 	if (!value || !extra_args)
 		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
+	errno = 0;
+	integer = strtoull(value, NULL, 0);
+	/* extra_args keeps default value, it should be replaced
+	 * only in case of successful parsing of the 'value' arg
+	 */
+	if (errno == 0)
+		*(uint64_t *)extra_args = integer;
+	return -errno;
 }
 
 static struct rte_eth_dev *
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [dpdk-stable] [PATCH v12 5/7] net/virtio-user: fix devargs parsing
       [not found]   ` <CGME20200416124317eucas1p15276ceb13bfb49ba429e4391d1ecce53@eucas1p1.samsung.com>
@ 2020-04-16 12:42     ` Ivan Dyukov
  0 siblings, 0 replies; 4+ messages in thread
From: Ivan Dyukov @ 2020-04-16 12:42 UTC (permalink / raw)
  To: dev, maxime.coquelin, i.dyukov, v.kuramshin, amorenoz,
	zhihong.wang, xiaolong.ye, mb
  Cc: stable

strtoull returns 0 if it fails to parse input string. It's ignored
in get_integer_arg.

This patch handles error cases for strtoull function.

Fixes: ce2eabdd43ec ("net/virtio-user: add virtual device")
Cc: stable@dpdk.org
Signed-off-by: Ivan Dyukov <i.dyukov@samsung.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index e61af4068..a79f68a36 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -477,12 +477,17 @@ static int
 get_integer_arg(const char *key __rte_unused,
 		const char *value, void *extra_args)
 {
+	uint64_t integer = 0;
 	if (!value || !extra_args)
 		return -EINVAL;
-
-	*(uint64_t *)extra_args = strtoull(value, NULL, 0);
-
-	return 0;
+	errno = 0;
+	integer = strtoull(value, NULL, 0);
+	/* extra_args keeps default value, it should be replaced
+	 * only in case of successful parsing of the 'value' arg
+	 */
+	if (errno == 0)
+		*(uint64_t *)extra_args = integer;
+	return -errno;
 }
 
 static struct rte_eth_dev *
-- 
2.17.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2020-04-16 12:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20191212085012.9170-1-i.dyukov@samsung.com>
     [not found] ` <20200406085855.25773-1-i.dyukov@samsung.com>
     [not found]   ` <CGME20200406085918eucas1p200d058b72ac3e35b61dd1a119b9fcb55@eucas1p2.samsung.com>
     [not found]     ` <20200406085855.25773-4-i.dyukov@samsung.com>
2020-04-15 15:09       ` [dpdk-stable] [PATCH v9 3/5] net/virtio-user: fix devargs parsing Maxime Coquelin
     [not found] ` <20200415200423.6410-1-i.dyukov@samsung.com>
     [not found]   ` <CGME20200415200445eucas1p2406d3f5b1794958c8345741c83d2000e@eucas1p2.samsung.com>
2020-04-15 20:03     ` [dpdk-stable] [PATCH v10 4/6] " Ivan Dyukov
     [not found] ` <20200416055309.19679-1-i.dyukov@samsung.com>
     [not found]   ` <CGME20200416055330eucas1p120bee1af98e108e09dd7515faf094c73@eucas1p1.samsung.com>
2020-04-16  5:53     ` [dpdk-stable] [PATCH v11 " Ivan Dyukov
     [not found] ` <20200416124258.15549-1-i.dyukov@samsung.com>
     [not found]   ` <CGME20200416124317eucas1p15276ceb13bfb49ba429e4391d1ecce53@eucas1p1.samsung.com>
2020-04-16 12:42     ` [dpdk-stable] [PATCH v12 5/7] " Ivan Dyukov

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).