From: Pablo de Lara <pablo.de.lara.guarch@intel.com>
To: declan.doherty@intel.com
Cc: dev@dpdk.org, Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev] [PATCH] cryptodev: fix NULL pointer dereference
Date: Mon, 31 Jul 2017 03:30:50 +0100 [thread overview]
Message-ID: <20170731023050.28956-1-pablo.de.lara.guarch@intel.com> (raw)
When registering a crypto driver, if memory allocation
fails, application should exit and do not allow
a NULL pointer dereference.
Coverity issue: 158645
Fixes: 7a364faef185 ("cryptodev: remove crypto device type enumeration")
Signed-off-by: Pablo de Lara <pablo.de.lara.guarch@intel.com>
---
lib/librte_cryptodev/rte_cryptodev.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/lib/librte_cryptodev/rte_cryptodev.c b/lib/librte_cryptodev/rte_cryptodev.c
index 327d7e8..4492b0d 100644
--- a/lib/librte_cryptodev/rte_cryptodev.c
+++ b/lib/librte_cryptodev/rte_cryptodev.c
@@ -1404,6 +1404,12 @@ rte_cryptodev_allocate_driver(const struct rte_driver *drv)
struct cryptodev_driver *driver;
driver = malloc(sizeof(*driver));
+
+ if (driver == NULL)
+ rte_exit(EXIT_FAILURE,
+ "Could not allocate memory for crypto driver %u\n",
+ nb_drivers);
+
driver->driver = drv;
driver->id = nb_drivers;
--
2.9.4
next reply other threads:[~2017-07-31 10:30 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 2:30 Pablo de Lara [this message]
2017-07-31 9:18 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
2017-07-31 19:33 ` Thomas Monjalon
2017-08-01 7:10 ` De Lara Guarch, Pablo
2017-08-01 8:13 ` Sergio Gonzalez Monroy
2017-08-01 9:35 ` Thomas Monjalon
2017-08-01 10:17 ` Sergio Gonzalez Monroy
2017-08-01 10:48 ` De Lara Guarch, Pablo
2017-08-01 12:36 ` Thomas Monjalon
2017-08-16 2:41 ` [dpdk-dev] [PATCH v3] cryptodev: allocate driver structure statically Pablo de Lara
2017-09-04 10:38 ` Rybalchenko, Kirill
2017-09-06 10:27 ` De Lara Guarch, Pablo
2017-07-31 12:32 ` [dpdk-dev] [PATCH] cryptodev: fix NULL pointer dereference Sergio Gonzalez Monroy
2017-07-31 15:22 ` Thomas Monjalon
2017-08-01 7:09 ` De Lara Guarch, Pablo
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=20170731023050.28956-1-pablo.de.lara.guarch@intel.com \
--to=pablo.de.lara.guarch@intel.com \
--cc=declan.doherty@intel.com \
--cc=dev@dpdk.org \
/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).