DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
@ 2019-06-06 14:25 Asaf Penso
  0 siblings, 0 replies; 4+ messages in thread
From: Asaf Penso @ 2019-06-06 14:25 UTC (permalink / raw)
  To: Yongseok Koh, Shahaf Shuler; +Cc: dev, Ori Kam, Asaf Penso, stable

rte_calloc functions returns a non-null pointer in case of
success and null pointer in case of failure.

The return value should be checked and the function flow
should take that into consideration.

This patch adds a check for rte_calloc return value in function
flow_list_create.

Fixes: 84c406e7 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org

Signed-off-by: Asaf Penso <asafp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 9887018..a5821e5 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2092,6 +2092,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 	else
 		flow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void *));
 	flow = rte_calloc(__func__, 1, flow_size, 0);
+	if (!flow) {
+		rte_errno = ENOMEM;
+		return NULL;
+	}
 	flow->drv_type = flow_get_drv_type(dev, attr);
 	flow->ingress = attr->ingress;
 	flow->transfer = attr->transfer;
-- 
1.8.3.1


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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
  2019-07-02 15:00 ` Slava Ovsiienko
@ 2019-07-02 15:29   ` Raslan Darawsheh
  0 siblings, 0 replies; 4+ messages in thread
From: Raslan Darawsheh @ 2019-07-02 15:29 UTC (permalink / raw)
  To: Slava Ovsiienko, Asaf Penso, Yongseok Koh, Shahaf Shuler; +Cc: dev, stable

Hi,

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Asaf Penso
> Sent: Wednesday, June 19, 2019 12:46
> To: Yongseok Koh <yskoh@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return
> value
>
> rte_calloc functions returns a non-null pointer in case of success and
> null pointer in case of failure.
>
> The return value should be checked and the function flow should take
> that into consideration.
>
> This patch adds a check for rte_calloc return value in function
> flow_list_create.
>
> Fixes: 84c406e7 ("net/mlx5: add flow translate function")
> Cc: stable@dpdk.org
>
> Signed-off-by: Asaf Penso <asafp@mellanox.com>
> 

Patch applied to next-net-mlx

Kindest regards
Raslan Darawsheh

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

* Re: [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
  2019-06-19  9:46 Asaf Penso
@ 2019-07-02 15:00 ` Slava Ovsiienko
  2019-07-02 15:29   ` Raslan Darawsheh
  0 siblings, 1 reply; 4+ messages in thread
From: Slava Ovsiienko @ 2019-07-02 15:00 UTC (permalink / raw)
  To: Asaf Penso, Yongseok Koh, Shahaf Shuler; +Cc: dev, stable

> -----Original Message-----
> From: dev <dev-bounces@dpdk.org> On Behalf Of Asaf Penso
> Sent: Wednesday, June 19, 2019 12:46
> To: Yongseok Koh <yskoh@mellanox.com>; Shahaf Shuler
> <shahafs@mellanox.com>
> Cc: dev@dpdk.org; stable@dpdk.org
> Subject: [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
> 
> rte_calloc functions returns a non-null pointer in case of success and null
> pointer in case of failure.
> 
> The return value should be checked and the function flow should take that
> into consideration.
> 
> This patch adds a check for rte_calloc return value in function
> flow_list_create.
> 
> Fixes: 84c406e7 ("net/mlx5: add flow translate function")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Asaf Penso <asafp@mellanox.com>
Acked-by: Viacheslav Ovsiienko <viacheslavo@mellanox.com>
Thanks

> ---
>  drivers/net/mlx5/mlx5_flow.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
> index 9887018..a5821e5 100644
> --- a/drivers/net/mlx5/mlx5_flow.c
> +++ b/drivers/net/mlx5/mlx5_flow.c
> @@ -2092,6 +2092,10 @@ uint32_t mlx5_flow_adjust_priority(struct
> rte_eth_dev *dev, int32_t priority,
>  	else
>  		flow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void
> *));
>  	flow = rte_calloc(__func__, 1, flow_size, 0);
> +	if (!flow) {
> +		rte_errno = ENOMEM;
> +		return NULL;
> +	}
>  	flow->drv_type = flow_get_drv_type(dev, attr);
>  	flow->ingress = attr->ingress;
>  	flow->transfer = attr->transfer;
> --
> 1.8.3.1


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

* [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
@ 2019-06-19  9:46 Asaf Penso
  2019-07-02 15:00 ` Slava Ovsiienko
  0 siblings, 1 reply; 4+ messages in thread
From: Asaf Penso @ 2019-06-19  9:46 UTC (permalink / raw)
  To: yskoh, shahafs; +Cc: dev, stable

rte_calloc functions returns a non-null pointer in case of
success and null pointer in case of failure.

The return value should be checked and the function flow
should take that into consideration.

This patch adds a check for rte_calloc return value in function
flow_list_create.

Fixes: 84c406e7 ("net/mlx5: add flow translate function")
Cc: stable@dpdk.org

Signed-off-by: Asaf Penso <asafp@mellanox.com>
---
 drivers/net/mlx5/mlx5_flow.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/mlx5/mlx5_flow.c b/drivers/net/mlx5/mlx5_flow.c
index 9887018..a5821e5 100644
--- a/drivers/net/mlx5/mlx5_flow.c
+++ b/drivers/net/mlx5/mlx5_flow.c
@@ -2092,6 +2092,10 @@ uint32_t mlx5_flow_adjust_priority(struct rte_eth_dev *dev, int32_t priority,
 	else
 		flow_size += RTE_ALIGN_CEIL(sizeof(uint16_t), sizeof(void *));
 	flow = rte_calloc(__func__, 1, flow_size, 0);
+	if (!flow) {
+		rte_errno = ENOMEM;
+		return NULL;
+	}
 	flow->drv_type = flow_get_drv_type(dev, attr);
 	flow->ingress = attr->ingress;
 	flow->transfer = attr->transfer;
-- 
1.8.3.1


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

end of thread, other threads:[~2019-07-02 15:29 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-06 14:25 [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value Asaf Penso
2019-06-19  9:46 Asaf Penso
2019-07-02 15:00 ` Slava Ovsiienko
2019-07-02 15:29   ` Raslan Darawsheh

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