DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Dai <wei.dai@intel.com>
To: ferruh.yigit@intel.com, anatoly.burakov@intel.com
Cc: dev@dpdk.org, Wei Dai <wei.dai@intel.com>, stable@dpdk.org
Subject: [dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver
Date: Tue, 15 May 2018 22:40:51 +0800	[thread overview]
Message-ID: <1526395251-27894-1-git-send-email-wei.dai@intel.com> (raw)

In pci_get_kernel_driver_by_path(), the available memory size of
dri_name should be strlen(name + 1) + 1, not the size of the
pointer (8 bytes), so "vfio-pci" is truncated to "vfio-pc"
ended with number 0.
This patch fixes it.

Fixes: fe5f777b5383 ("bus/pci: replace strncpy by strlcpy")
Cc: stable@dpdk.org

Signed-off-by: Wei Dai <wei.dai@intel.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 a73ee49..cc6b383 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 + 1) + 1);
 		return 0;
 	}
 
-- 
2.5.5

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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-15 14:40 Wei Dai [this message]
2018-05-15 15:10 ` Dai, Wei

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=1526395251-27894-1-git-send-email-wei.dai@intel.com \
    --to=wei.dai@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=stable@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).