DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] usertools: fix parsing error from dpdk-pmdinfo.py
@ 2020-11-19  9:44 Julien Massonneau
  2020-11-22 21:09 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: Julien Massonneau @ 2020-11-19  9:44 UTC (permalink / raw)
  To: Neil Horman; +Cc: dev, stable

In the display_pmd_info_strings function, the script parses the section
until to find a byte between 32 and 127, and get all data
until a byte equals to 0.
After, it searches "PMD_INFO_STRING" in the data and passes the whole
string in the parse_pmd_info_string function, which split the string
with "=" and convert it in python dict with json.loads().

But the string may contain a "=" before "PMD_INFO_STRING",
so it is not correctly split and will lead to an error
(json.decoder.JSONDecodeError).

Example of a string encountered that leads to an error:

"Ag%=C£°ÐÊ+Ë®{0´wË-£0òjB·;¾¬úPMD_INFO_STRING= {"name" :
"net_octeontx", "params" : "nr_port=<int> ", "pci_ids" : []}"

Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")
Cc: stable@dpdk.org

Signed-off-by: Julien Massonneau <julien.massonneau@6wind.com>
---
 usertools/dpdk-pmdinfo.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py
index 95fb0111d..263465086 100755
--- a/usertools/dpdk-pmdinfo.py
+++ b/usertools/dpdk-pmdinfo.py
@@ -349,7 +349,7 @@ def display_pmd_info_strings(self, section_spec):
             mystring = force_unicode(data[dataptr:endptr])
             rc = mystring.find("PMD_INFO_STRING")
             if (rc != -1):
-                self.parse_pmd_info_string(mystring)
+                self.parse_pmd_info_string(mystring[rc:])
 
             dataptr = endptr
 
-- 
2.28.0


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

* Re: [dpdk-dev] [PATCH] usertools: fix parsing error from dpdk-pmdinfo.py
  2020-11-19  9:44 [dpdk-dev] [PATCH] usertools: fix parsing error from dpdk-pmdinfo.py Julien Massonneau
@ 2020-11-22 21:09 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2020-11-22 21:09 UTC (permalink / raw)
  To: Julien Massonneau; +Cc: dev, stable, david.marchand, Stephen Hemminger

19/11/2020 10:44, Julien Massonneau:
> In the display_pmd_info_strings function, the script parses the section
> until to find a byte between 32 and 127, and get all data
> until a byte equals to 0.
> After, it searches "PMD_INFO_STRING" in the data and passes the whole
> string in the parse_pmd_info_string function, which split the string
> with "=" and convert it in python dict with json.loads().
> 
> But the string may contain a "=" before "PMD_INFO_STRING",
> so it is not correctly split and will lead to an error
> (json.decoder.JSONDecodeError).
> 
> Example of a string encountered that leads to an error:
> 
> "Ag%=C£°ÐÊ+Ë®{0´wË-£0òjB·;¾¬úPMD_INFO_STRING= {"name" :
> "net_octeontx", "params" : "nr_port=<int> ", "pci_ids" : []}"
> 
> Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information")
> Cc: stable@dpdk.org
> 
> Signed-off-by: Julien Massonneau <julien.massonneau@6wind.com>

Applied, thanks



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

end of thread, other threads:[~2020-11-22 21:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-19  9:44 [dpdk-dev] [PATCH] usertools: fix parsing error from dpdk-pmdinfo.py Julien Massonneau
2020-11-22 21:09 ` Thomas Monjalon

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