summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBala-Vignesh-Reddy <reddybalavignesh9979@gmail.com>2025-08-08 13:38:30 +0530
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-10-15 11:59:54 +0200
commit18cb2685358f74710ad10b1a720c1f01401b1814 (patch)
tree1d2b6c09392f3acf916b6d66d59387463dc048c9 /tools
parentdadf1f4423e1d6e79fe8ea87fdd0422f5092eb71 (diff)
downloadlinux-18cb2685358f74710ad10b1a720c1f01401b1814.tar.gz
linux-18cb2685358f74710ad10b1a720c1f01401b1814.tar.bz2
linux-18cb2685358f74710ad10b1a720c1f01401b1814.zip
selftests: arm64: Check fread return value in exec_target
[ Upstream commit a679e5683d3eef22ca12514ff8784b2b914ebedc ] Fix -Wunused-result warning generated when compiled with gcc 13.3.0, by checking fread's return value and handling errors, preventing potential failures when reading from stdin. Fixes compiler warning: warning: ignoring return value of 'fread' declared with attribute 'warn_unused_result' [-Wunused-result] Fixes: 806a15b2545e ("kselftests/arm64: add PAuth test for whether exec() changes keys") Signed-off-by: Bala-Vignesh-Reddy <reddybalavignesh9979@gmail.com> Reviewed-by: Mark Brown <broonie@kernel.org> Signed-off-by: Will Deacon <will@kernel.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'tools')
-rw-r--r--tools/testing/selftests/arm64/pauth/exec_target.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/tools/testing/selftests/arm64/pauth/exec_target.c b/tools/testing/selftests/arm64/pauth/exec_target.c
index 4435600ca400..e597861b26d6 100644
--- a/tools/testing/selftests/arm64/pauth/exec_target.c
+++ b/tools/testing/selftests/arm64/pauth/exec_target.c
@@ -13,7 +13,12 @@ int main(void)
unsigned long hwcaps;
size_t val;
- fread(&val, sizeof(size_t), 1, stdin);
+ size_t size = fread(&val, sizeof(size_t), 1, stdin);
+
+ if (size != 1) {
+ fprintf(stderr, "Could not read input from stdin\n");
+ return EXIT_FAILURE;
+ }
/* don't try to execute illegal (unimplemented) instructions) caller
* should have checked this and keep worker simple