[dpdk-stable] patch 'usertools: replace unsafe input function' has been queued to LTS release 18.11.3

Kevin Traynor ktraynor at redhat.com
Thu Sep 5 12:17:28 CEST 2019


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 <andrius.sirvys at intel.com>
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 <andrius.sirvys at intel.com>
Acked-by: Kevin Laatz <kevin.laatz at intel.com>
---
 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 at 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:


More information about the stable mailing list