aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/arm64
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2021-03-19 16:53:26 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2021-03-23 16:36:30 +0000
commit31c88729a7ad2b9871e6a73e491ec7223880d633 (patch)
tree24d9b0ae2c6de1ceaa47a62e8c5e335483fc2a27 /tools/testing/selftests/arm64
parentkselftest/arm64: mte: Fix pthread linking (diff)
downloadlinux-dev-31c88729a7ad2b9871e6a73e491ec7223880d633.tar.xz
linux-dev-31c88729a7ad2b9871e6a73e491ec7223880d633.zip
kselftest/arm64: mte: ksm_options: Fix fscanf warning
Out of the box Ubuntu's 20.04 compiler warns about missing return value checks for fscanf() calls. Make GCC happy by checking whether we actually parsed one integer. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Mark Brown <broone@kernel.org> Link: https://lore.kernel.org/r/20210319165334.29213-4-andre.przywara@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
Diffstat (limited to 'tools/testing/selftests/arm64')
-rw-r--r--tools/testing/selftests/arm64/mte/check_ksm_options.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/testing/selftests/arm64/mte/check_ksm_options.c b/tools/testing/selftests/arm64/mte/check_ksm_options.c
index 3b23c4d61d38..88c74bc46d4f 100644
--- a/tools/testing/selftests/arm64/mte/check_ksm_options.c
+++ b/tools/testing/selftests/arm64/mte/check_ksm_options.c
@@ -33,7 +33,10 @@ static unsigned long read_sysfs(char *str)
ksft_print_msg("ERR: missing %s\n", str);
return 0;
}
- fscanf(f, "%lu", &val);
+ if (fscanf(f, "%lu", &val) != 1) {
+ ksft_print_msg("ERR: parsing %s\n", str);
+ val = 0;
+ }
fclose(f);
return val;
}