From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 3425BA04DD; Thu, 19 Nov 2020 10:44:08 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0CCDA5937; Thu, 19 Nov 2020 10:44:07 +0100 (CET) Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 152F8DED; Thu, 19 Nov 2020 10:44:05 +0100 (CET) Received: from ubuntu2004.vm.6wind.com (unknown [10.16.0.145]) by proxy.6wind.com (Postfix) with ESMTP id C4FF248F93A; Thu, 19 Nov 2020 10:44:03 +0100 (CET) From: Julien Massonneau To: Neil Horman Cc: dev@dpdk.org, stable@dpdk.org Date: Thu, 19 Nov 2020 10:44:01 +0100 Message-Id: <20201119094401.1322-1-julien.massonneau@6wind.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] usertools: fix parsing error from dpdk-pmdinfo.py X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" 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 --- 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