DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] cryptodev: fix NULL pointer dereference
@ 2017-07-31  2:30 Pablo de Lara
  2017-07-31  9:18 ` [dpdk-dev] [PATCH v2] " Pablo de Lara
  2017-07-31 12:32 ` [dpdk-dev] [PATCH] cryptodev: fix NULL pointer dereference Sergio Gonzalez Monroy
  0 siblings, 2 replies; 15+ messages in thread
From: Pablo de Lara @ 2017-07-31  2:30 UTC (permalink / raw)
  To: declan.doherty; +Cc: dev, Pablo de Lara

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

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

end of thread, other threads:[~2017-09-06 10:27 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-07-31  2:30 [dpdk-dev] [PATCH] cryptodev: fix NULL pointer dereference Pablo de Lara
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

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