From: Asaf Penso <asafp@mellanox.com>
To: Yongseok Koh <yskoh@mellanox.com>, Shahaf Shuler <shahafs@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Ori Kam <orika@mellanox.com>,
Asaf Penso <asafp@mellanox.com>,
"stable@dpdk.org" <stable@dpdk.org>
Subject: [dpdk-dev] [PATCH] net/mlx5: fix check for rte calloc return value
Date: Thu, 6 Jun 2019 14:25:46 +0000 [thread overview]
Message-ID: <1559831132-176061-1-git-send-email-asafp@mellanox.com> (raw)
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
next reply other threads:[~2019-06-06 14:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-06-06 14:25 Asaf Penso [this message]
2019-06-19 9:46 Asaf Penso
2019-07-02 15:00 ` Slava Ovsiienko
2019-07-02 15:29 ` Raslan Darawsheh
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1559831132-176061-1-git-send-email-asafp@mellanox.com \
--to=asafp@mellanox.com \
--cc=dev@dpdk.org \
--cc=orika@mellanox.com \
--cc=shahafs@mellanox.com \
--cc=stable@dpdk.org \
--cc=yskoh@mellanox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).