DPDK patches and discussions
 help / color / mirror / Atom feed
From: Jerin Jacob <jerin.jacob@caviumnetworks.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net, ferruh.yigit@intel.com,
	Jerin Jacob <jerin.jacob@caviumnetworks.com>,
	Andy Green <andy@warmcat.com>,
	Pablo de Lara <pablo.de.lara.guarch@intel.com>
Subject: [dpdk-dev]  [PATCH] bus/pci: fix driver name string manipulation
Date: Tue, 15 May 2018 15:33:35 +0530	[thread overview]
Message-ID: <20180515100335.13051-1-jerin.jacob@caviumnetworks.com> (raw)

sizeof(dri_name) is 8B on 64Bit systems.The intended operation is coping
the string after '/' from the string `name`.

This bug is not letting to probe any device string >8B hence results in
the testpmd error("No ethernet devices found) on some PMDs.

Cc: Andy Green <andy@warmcat.com>
Cc: Pablo de Lara <pablo.de.lara.guarch@intel.com>

Fixes: fe5f777b538 ("bus/pci: replace strncpy by strlcpy")

Signed-off-by: Jerin Jacob <jerin.jacob@caviumnetworks.com>
---
 drivers/bus/pci/linux/pci.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/bus/pci/linux/pci.c b/drivers/bus/pci/linux/pci.c
index a73ee49c2..cd45875b1 100644
--- a/drivers/bus/pci/linux/pci.c
+++ b/drivers/bus/pci/linux/pci.c
@@ -54,7 +54,7 @@ pci_get_kernel_driver_by_path(const char *filename, char *dri_name)
 
 	name = strrchr(path, '/');
 	if (name) {
-		strlcpy(dri_name, name + 1, sizeof(dri_name));
+		strlcpy(dri_name, name + 1, strlen(name));
 		return 0;
 	}
 
-- 
2.17.0

             reply	other threads:[~2018-05-15 10:04 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 10:03 Jerin Jacob [this message]
2018-05-15 10:19 ` Andy Green
2018-05-15 10:31   ` Jerin Jacob
2018-05-15 10:41     ` Andy Green
2018-05-15 10:54       ` Thomas Monjalon

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=20180515100335.13051-1-jerin.jacob@caviumnetworks.com \
    --to=jerin.jacob@caviumnetworks.com \
    --cc=andy@warmcat.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    --cc=thomas@monjalon.net \
    /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).