DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver
@ 2018-05-15 14:40 Wei Dai
  2018-05-15 15:10 ` Dai, Wei
  0 siblings, 1 reply; 2+ messages in thread
From: Wei Dai @ 2018-05-15 14:40 UTC (permalink / raw)
  To: ferruh.yigit, anatoly.burakov; +Cc: dev, Wei Dai, stable

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

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

* Re: [dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver
  2018-05-15 14:40 [dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver Wei Dai
@ 2018-05-15 15:10 ` Dai, Wei
  0 siblings, 0 replies; 2+ messages in thread
From: Dai, Wei @ 2018-05-15 15:10 UTC (permalink / raw)
  To: Yigit, Ferruh, Burakov, Anatoly; +Cc: dev, stable

Give up this patch as there is already a patch
in http://dpdk.org/dev/patchwork/patch/40030/ bus/pci: correct the earlier strlcpy conversion

> -----Original Message-----
> From: Dai, Wei
> Sent: Tuesday, May 15, 2018 10:41 PM
> To: Yigit, Ferruh <ferruh.yigit@intel.com>; Burakov, Anatoly
> <anatoly.burakov@intel.com>
> Cc: dev@dpdk.org; Dai, Wei <wei.dai@intel.com>; stable@dpdk.org
> Subject: [PATCH] bus/pci: fix error in parsing vfio driver
> 
> 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

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

end of thread, other threads:[~2018-05-15 15:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-15 14:40 [dpdk-dev] [PATCH] bus/pci: fix error in parsing vfio driver Wei Dai
2018-05-15 15:10 ` Dai, Wei

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