From: Julien Massonneau Date: Thu, 19 Nov 2020 09:44:01 +0000 (+0100) Subject: usertools: fix pmdinfo parsing X-Git-Url: http://git.droids-corp.org/?p=dpdk.git;a=commitdiff_plain;h=3515fa1e5ecbe0099cb886b81ba77058d1a2d397 usertools: fix pmdinfo parsing 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= ", "pci_ids" : []}" Fixes: c67c9a5c646a ("tools: query binaries for HW and other support information") Cc: stable@dpdk.org Signed-off-by: Julien Massonneau --- diff --git a/usertools/dpdk-pmdinfo.py b/usertools/dpdk-pmdinfo.py index b4e8a48cde..3381aa616c 100755 --- a/usertools/dpdk-pmdinfo.py +++ b/usertools/dpdk-pmdinfo.py @@ -346,7 +346,7 @@ class ReadElf(object): 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