patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH] pci/windows: fix limit for hardware ID
@ 2020-12-11 19:15 Dmitry Kozlyuk
  2020-12-11 20:09 ` [dpdk-stable] [PATCH v2] " Dmitry Kozlyuk
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kozlyuk @ 2020-12-11 19:15 UTC (permalink / raw)
  To: dev; +Cc: Dmitry Kozlyuk, stable, Tal Shnaiderman

Hardware ID length is limited by MAX_DEVICE_ID_LEN [1]. No functional
change is intended: new value is 200, and previous one has been 260.
However, it's now correct and creates no bogus dependency on path limit.

[1]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/hardware-ids

Fixes: b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Cc: stable@dpdk.org
Cc: Tal Shnaiderman <talshn@nvidia.com>

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---
 drivers/bus/pci/windows/pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 33a5fb1d8..7130979e8 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -9,6 +9,7 @@
 #include "private.h"
 #include "pci_netuio.h"
 
+#include <cfgmgr32.h>
 #include <devpkey.h>
 
 #if defined RTE_TOOLCHAIN_GCC && (__MINGW64_VERSION_MAJOR < 8)
@@ -303,7 +304,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 {
 	struct rte_pci_device *dev;
 	int ret = -1;
-	char  pci_device_info[PATH_MAX];
+	char  pci_device_info[MAX_DEVICE_ID_LEN];
 	struct rte_pci_addr addr;
 	struct rte_pci_id pci_id;
 
@@ -314,7 +315,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 	memset(dev, 0, sizeof(*dev));
 
 	ret = get_pci_hardware_id(dev_info, device_info_data,
-		pci_device_info, PATH_MAX);
+		pci_device_info, sizeof(pci_device_info));
 	if (ret != 0)
 		goto end;
 
-- 
2.29.2


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

* [dpdk-stable] [PATCH v2] pci/windows: fix limit for hardware ID
  2020-12-11 19:15 [dpdk-stable] [PATCH] pci/windows: fix limit for hardware ID Dmitry Kozlyuk
@ 2020-12-11 20:09 ` Dmitry Kozlyuk
  2021-01-05 12:42   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Kozlyuk @ 2020-12-11 20:09 UTC (permalink / raw)
  To: dev
  Cc: Narcisa Ana Maria Vasile, Pallavi Kadam, Dmitry Kozlyuk, stable,
	Tal Shnaiderman

Length of hardware IDs list is limited by REGSTR_VAL_MAX_HCID_LEN [1],
which is currently 1024. With the old limit of 260, obtaining the list
could fail in a rare occasion of a very long result (no examples known).
This also removes a bogus dependency on the maximum path length.

[1]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/hardware-ids

Fixes: b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
Cc: stable@dpdk.org
Cc: Tal Shnaiderman <talshn@nvidia.com>

Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>
---

v2: change limit and description (self-fix)

 drivers/bus/pci/windows/pci.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/bus/pci/windows/pci.c b/drivers/bus/pci/windows/pci.c
index 33a5fb1d8..fbf0785fd 100644
--- a/drivers/bus/pci/windows/pci.c
+++ b/drivers/bus/pci/windows/pci.c
@@ -10,6 +10,7 @@
 #include "pci_netuio.h"
 
 #include <devpkey.h>
+#include <regstr.h>
 
 #if defined RTE_TOOLCHAIN_GCC && (__MINGW64_VERSION_MAJOR < 8)
 #include <devpropdef.h>
@@ -303,7 +304,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 {
 	struct rte_pci_device *dev;
 	int ret = -1;
-	char  pci_device_info[PATH_MAX];
+	char  pci_device_info[REGSTR_VAL_MAX_HCID_LEN];
 	struct rte_pci_addr addr;
 	struct rte_pci_id pci_id;
 
@@ -314,7 +315,7 @@ pci_scan_one(HDEVINFO dev_info, PSP_DEVINFO_DATA device_info_data)
 	memset(dev, 0, sizeof(*dev));
 
 	ret = get_pci_hardware_id(dev_info, device_info_data,
-		pci_device_info, PATH_MAX);
+		pci_device_info, sizeof(pci_device_info));
 	if (ret != 0)
 		goto end;
 
-- 
2.29.2


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

* Re: [dpdk-stable] [PATCH v2] pci/windows: fix limit for hardware ID
  2020-12-11 20:09 ` [dpdk-stable] [PATCH v2] " Dmitry Kozlyuk
@ 2021-01-05 12:42   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2021-01-05 12:42 UTC (permalink / raw)
  To: Dmitry Kozlyuk
  Cc: dev, stable, Narcisa Ana Maria Vasile, Pallavi Kadam, stable,
	Tal Shnaiderman

11/12/2020 21:09, Dmitry Kozlyuk:
> Length of hardware IDs list is limited by REGSTR_VAL_MAX_HCID_LEN [1],
> which is currently 1024. With the old limit of 260, obtaining the list
> could fail in a rare occasion of a very long result (no examples known).
> This also removes a bogus dependency on the maximum path length.
> 
> [1]: https://docs.microsoft.com/en-us/windows-hardware/drivers/install/hardware-ids
> 
> Fixes: b762221ac24f ("bus/pci: support Windows with bifurcated drivers")
> Cc: stable@dpdk.org
> Cc: Tal Shnaiderman <talshn@nvidia.com>
> 
> Signed-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>

Applied, thanks




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

end of thread, other threads:[~2021-01-05 12:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 19:15 [dpdk-stable] [PATCH] pci/windows: fix limit for hardware ID Dmitry Kozlyuk
2020-12-11 20:09 ` [dpdk-stable] [PATCH v2] " Dmitry Kozlyuk
2021-01-05 12:42   ` Thomas Monjalon

patches for DPDK stable branches

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://inbox.dpdk.org/stable/0 stable/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 stable stable/ http://inbox.dpdk.org/stable \
		stable@dpdk.org
	public-inbox-index stable

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.stable


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git