On 08-Apr-19 2:40 PM, Andrius Sirvys wrote:
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")
Cc: ciara.po...@intel.com

Signed-off-by: Andrius Sirvys <andrius.sir...@intel.com>
Acked-by: Kevin Laatz <kevin.la...@intel.com>
---
v2:raw_input doesn't exist in Python 3, added a clause
to check python version
---
  usertools/dpdk-telemetry-client.py | 5 +++++
  1 file changed, 5 insertions(+)

diff --git a/usertools/dpdk-telemetry-client.py 
b/usertools/dpdk-telemetry-client.py
index ce0c7a9..5f6c47b 100755
--- a/usertools/dpdk-telemetry-client.py
+++ b/usertools/dpdk-telemetry-client.py
@@ -14,6 +14,11 @@
  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:
def __init__(self):


Nitpicking, but PEP8 suggests two spaces before comment rather than one, e.g.

code  # comment

rather than

code # comment

Other than that,

Acked-by: Anatoly Burakov <anatoly.bura...@intel.com>

--
Thanks,
Anatoly

Reply via email to