diff options
author | Fenghua Yu <fenghua.yu@intel.com> | 2021-03-17 02:22:38 +0000 |
---|---|---|
committer | Shuah Khan <skhan@linuxfoundation.org> | 2021-04-02 13:51:36 -0600 |
commit | 2428673638ea28fa93d2a38b1c3e8d70122b00ee (patch) | |
tree | ba40c64b21e5bcea79744d7bd9760fd1b4408068 /tools/testing/selftests/resctrl/fill_buf.c | |
parent | 896016d2ad051811ff9c9c087393adc063322fbc (diff) | |
download | linux-2428673638ea28fa93d2a38b1c3e8d70122b00ee.tar.bz2 |
selftests/resctrl: Clean up resctrl features check
Checking resctrl features call strcmp() to compare feature strings
(e.g. "mba", "cat" etc). The checkings are error prone and don't have
good coding style. Define the constant strings in macros and call
strncmp() to solve the potential issues.
Suggested-by: Shuah Khan <skhan@linuxfoundation.org>
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/testing/selftests/resctrl/fill_buf.c')
-rw-r--r-- | tools/testing/selftests/resctrl/fill_buf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/testing/selftests/resctrl/fill_buf.c b/tools/testing/selftests/resctrl/fill_buf.c index 79c611c99a3d..51e5cf22632f 100644 --- a/tools/testing/selftests/resctrl/fill_buf.c +++ b/tools/testing/selftests/resctrl/fill_buf.c @@ -115,7 +115,7 @@ static int fill_cache_read(unsigned char *start_ptr, unsigned char *end_ptr, while (1) { ret = fill_one_span_read(start_ptr, end_ptr); - if (!strcmp(resctrl_val, "cat")) + if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) break; } @@ -134,7 +134,7 @@ static int fill_cache_write(unsigned char *start_ptr, unsigned char *end_ptr, { while (1) { fill_one_span_write(start_ptr, end_ptr); - if (!strcmp(resctrl_val, "cat")) + if (!strncmp(resctrl_val, CAT_STR, sizeof(CAT_STR))) break; } |