diff options
author | Fenghua Yu <fenghua.yu@intel.com> | 2021-03-17 05:22:54 +0300 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2021-04-02 22:58:37 +0300 |
commit | 1205b688c92558a04d8dd4cbc2b213e0fceba5db (patch) | |
tree | 7fb102a5a1927899dd66f8e6ac11b97e762ae2e5 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | d81343b5eedf84be71a4313e8fd073d0c510afcf (diff) | |
download | linux-1205b688c92558a04d8dd4cbc2b213e0fceba5db.tar.xz |
selftests/resctrl: Fix checking for < 0 for unsigned values
Dan reported following static checker warnings
tools/testing/selftests/resctrl/resctrl_val.c:545 measure_vals()
warn: 'bw_imc' unsigned <= 0
tools/testing/selftests/resctrl/resctrl_val.c:549 measure_vals()
warn: 'bw_resc_end' unsigned <= 0
These warnings are reported because
1. measure_vals() declares 'bw_imc' and 'bw_resc_end' as unsigned long
variables
2. Return value of get_mem_bw_imc() and get_mem_bw_resctrl() are assigned
to 'bw_imc' and 'bw_resc_end' respectively
3. The returned values are checked for <= 0 to see if the calls failed
Checking for < 0 for an unsigned value doesn't make any sense.
Fix this issue by changing the implementation of get_mem_bw_imc() and
get_mem_bw_resctrl() such that they now accept reference to a variable
and set the variable appropriately upon success and return 0, else return
< 0 on error.
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Tested-by: Babu Moger <babu.moger@amd.com>
Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Signed-off-by: Shuah Khan <skhan@linuxfoundation.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions