aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Przywara <[email protected]>2021-03-19 16:53:26 +0000
committerCatalin Marinas <[email protected]>2021-03-23 16:36:30 +0000
commit31c88729a7ad2b9871e6a73e491ec7223880d633 (patch)
tree24d9b0ae2c6de1ceaa47a62e8c5e335483fc2a27
parente5decefd884da1c2c6ea18fca17b80b189afcc43 (diff)
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 <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
-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;
}