DPDK patches and discussions
 help / color / mirror / Atom feed
From: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
To: dev@dpdk.org
Cc: maxime.coquelin@redhat.com, tiwei.bie@intel.com,
	zhihong.wang@intel.com,
	Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
Subject: [dpdk-dev] [PATCH 2/3] net/virtio: fix null pointer checking
Date: Wed,  3 Apr 2019 17:08:11 +0100	[thread overview]
Message-ID: <20190403160811.1282-1-mohammad.abdul.awal@intel.com> (raw)

Null value of device name should return error without further processing.

Fixes: 1c8489da56 ("net/virtio-user: fix multi-process support")

Signed-off-by: Mohammad Abdul Awal <mohammad.abdul.awal@intel.com>
---
 drivers/net/virtio/virtio_user_ethdev.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c
index 129c2b9ef..cefc6da66 100644
--- a/drivers/net/virtio/virtio_user_ethdev.c
+++ b/drivers/net/virtio/virtio_user_ethdev.c
@@ -516,6 +516,10 @@ virtio_user_pmd_probe(struct rte_vdev_device *dev)
 
 	if (rte_eal_process_type() == RTE_PROC_SECONDARY) {
 		const char *name = rte_vdev_device_name(dev);
+		if (name == NULL) {
+			RTE_LOG(ERR, PMD, "Device name is NULL\n");
+			return -1;
+		}
 		eth_dev = rte_eth_dev_attach_secondary(name);
 		if (!eth_dev) {
 			RTE_LOG(ERR, PMD, "Failed to probe %s\n", name);
-- 
2.17.1

             reply	other threads:[~2019-04-03 16:08 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-03 16:08 Mohammad Abdul Awal [this message]
2019-04-03 16:08 ` Mohammad Abdul Awal
2019-04-04  6:22 ` Tiwei Bie
2019-04-04  6:22   ` Tiwei Bie
2019-04-04 10:22   ` Mohammad Abdul Awal
2019-04-04 10:22     ` Mohammad Abdul Awal

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=20190403160811.1282-1-mohammad.abdul.awal@intel.com \
    --to=mohammad.abdul.awal@intel.com \
    --cc=dev@dpdk.org \
    --cc=maxime.coquelin@redhat.com \
    --cc=tiwei.bie@intel.com \
    --cc=zhihong.wang@intel.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).