[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20220915133437.36827-1-xu.panda@zte.com.cn>
Date: Thu, 15 Sep 2022 13:34:39 +0000
From: cgel.zte@...il.com
To: linux-kernel@...r.kernel.org
Cc: ray.huang@....com, dsmythies@...us.net, rafael.j.wysocki@...el.com,
Jinzhou.Su@....com, Xu Panda <xu.panda@....com.cn>,
Zeal Robot <zealci@....com.cn>,
zhanglin <zhang.lin16@....com.cn>
Subject: [PATCH linux-next] tools/power/x86/intel_pstate_tracer: Use absolute path for grep
From: Xu Panda <xu.panda@....com.cn>
Not using absolute path when invoking grep can lead to serious
security issues
Reported-by: Zeal Robot <zealci@....com.cn>
Signed-off-by: Xu Panda <xu.panda@....com.cn>
Reviewed-by: zhanglin <zhang.lin16@....com.cn>
---
tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
index b46e9eb8f5aa..d6fae6e51d30 100755
--- a/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
+++ b/tools/power/x86/intel_pstate_tracer/intel_pstate_tracer.py
@@ -348,8 +348,8 @@ def split_csv(current_max_cpu, cpu_mask):
if os.path.exists('cpu.csv'):
for index in range(0, current_max_cpu + 1):
if cpu_mask[int(index)] != 0:
- os.system('grep -m 1 common_cpu cpu.csv > cpu{:0>3}.csv'.format(index))
- os.system('grep CPU_{:0>3} cpu.csv >> cpu{:0>3}.csv'.format(index, index))
+ os.system('/usr/bin/grep -m 1 common_cpu cpu.csv > cpu{:0>3}.csv'.format(index))
+ os.system('/usr/bin/grep CPU_{:0>3} cpu.csv >> cpu{:0>3}.csv'.format(index, index))
def fix_ownership(path):
"""Change the owner of the file to SUDO_UID, if required"""
--
2.15.2
Powered by blists - more mailing lists