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 B3AE1A2E1B for ; Thu, 5 Sep 2019 12:19:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A661C1EF69; Thu, 5 Sep 2019 12:19:03 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id B44FA1EF74 for ; Thu, 5 Sep 2019 12:19:01 +0200 (CEST) Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2D02F3064FD4; Thu, 5 Sep 2019 10:19:01 +0000 (UTC) Received: from rh.redhat.com (ovpn-117-52.ams2.redhat.com [10.36.117.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id 1E7E219C6A; Thu, 5 Sep 2019 10:18:59 +0000 (UTC) From: Kevin Traynor To: Andrius Sirvys Cc: Kevin Laatz , dpdk stable Date: Thu, 5 Sep 2019 11:17:28 +0100 Message-Id: <20190905101754.21933-28-ktraynor@redhat.com> In-Reply-To: <20190905101754.21933-1-ktraynor@redhat.com> References: <20190905101754.21933-1-ktraynor@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.45]); Thu, 05 Sep 2019 10:19:01 +0000 (UTC) Subject: [dpdk-stable] patch 'usertools: replace unsafe input function' has been queued to LTS release 18.11.3 X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi, FYI, your patch has been queued to LTS release 18.11.3 Note it hasn't been pushed to http://dpdk.org/browse/dpdk-stable yet. It will be pushed if I get no objections before 09/12/19. So please shout if anyone has objections. Also note that after the patch there's a diff of the upstream commit vs the patch applied to the branch. This will indicate if there was any rebasing needed to apply to the stable branch. If there were code changes for rebasing (ie: not only metadata diffs), please double check that the rebase was correctly done. Queued patches are on a temporary branch at: https://github.com/kevintraynor/dpdk-stable-queue This queued commit can be viewed at: https://github.com/kevintraynor/dpdk-stable-queue/commit/5636553a2ddf31e65ae51f6fe99c9a9fddd0cbf8 Thanks. Kevin Traynor --- >From 5636553a2ddf31e65ae51f6fe99c9a9fddd0cbf8 Mon Sep 17 00:00:00 2001 From: Andrius Sirvys Date: Mon, 8 Apr 2019 14:54:41 +0100 Subject: [PATCH] usertools: replace unsafe input function [ upstream commit 53f293c9a7833747d90b90bf33d12fe1d4f8ef1e ] LGTM static code analysis tool reports that the function 'input' is unsafe. Changed to use raw_input which then converts it using ast.literal_eval() which is safe. Fixes: d1b94da4a4e0 ("usertools: add client script for telemetry") Signed-off-by: Andrius Sirvys Acked-by: Kevin Laatz --- usertools/dpdk-telemetry-client.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py index 6dcf62bac..4afa2f84c 100644 --- a/usertools/dpdk-telemetry-client.py +++ b/usertools/dpdk-telemetry-client.py @@ -14,4 +14,9 @@ API_UNREG = "{\"action\":2,\"command\":\"clients\",\"data\":{\"client_path\":\"" DEFAULT_FP = "/var/run/dpdk/default_client" +try: + raw_input # Python 2 +except NameError: + raw_input = input # Python 3 + class Socket: @@ -72,5 +77,5 @@ class Client: def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics for given client print("\nPlease enter the number of times you'd like to continuously request Metrics:") - n_requests = int(input("\n:")) + n_requests = int(ast.literal_eval(raw_input("\n:"))) print("\033[F") #Removes the user input from screen, cleans it up print("\033[K") @@ -87,5 +92,5 @@ class Client: try: - self.choice = int(input("\n:")) + self.choice = int(ast.literal_eval(raw_input("\n:"))) print("\033[F") #Removes the user input for screen, cleans it up print("\033[K") -- 2.20.1 --- Diff of the applied patch vs upstream commit (please double-check if non-empty: --- --- - 2019-09-05 10:36:49.219805512 +0100 +++ 0028-usertools-replace-unsafe-input-function.patch 2019-09-05 10:36:47.524700187 +0100 @@ -1 +1 @@ -From 53f293c9a7833747d90b90bf33d12fe1d4f8ef1e Mon Sep 17 00:00:00 2001 +From 5636553a2ddf31e65ae51f6fe99c9a9fddd0cbf8 Mon Sep 17 00:00:00 2001 @@ -5,0 +6,2 @@ +[ upstream commit 53f293c9a7833747d90b90bf33d12fe1d4f8ef1e ] + @@ -11 +12,0 @@ -Cc: stable@dpdk.org @@ -20 +21 @@ -index 572ff56bb..4b0502ff9 100755 +index 6dcf62bac..4afa2f84c 100644 @@ -23 +24 @@ -@@ -16,4 +16,9 @@ GLOBAL_METRICS_REQ = "{\"action\":0,\"command\":\"global_stat_values\",\"data\": +@@ -14,4 +14,9 @@ API_UNREG = "{\"action\":2,\"command\":\"clients\",\"data\":{\"client_path\":\"" @@ -33 +34 @@ -@@ -74,5 +79,5 @@ class Client: +@@ -72,5 +77,5 @@ class Client: @@ -40 +41 @@ -@@ -95,5 +100,5 @@ class Client: +@@ -87,5 +92,5 @@ class Client: