aboutsummaryrefslogtreecommitdiffstats
path: root/tools/testing/selftests/arm64
diff options
context:
space:
mode:
authorAndre Przywara <andre.przywara@arm.com>2021-03-19 16:53:27 +0000
committerCatalin Marinas <catalin.marinas@arm.com>2021-03-24 15:43:01 +0000
commit46cb11b17c7a917e0eb5c7aa87a7bc6cda455a5e (patch)
treea0fc436b559c4c46dd17e32b33321bfdc4b5803b /tools/testing/selftests/arm64
parentkselftest/arm64: mte: ksm_options: Fix fscanf warning (diff)
downloadlinux-dev-46cb11b17c7a917e0eb5c7aa87a7bc6cda455a5e.tar.xz
linux-dev-46cb11b17c7a917e0eb5c7aa87a7bc6cda455a5e.zip
kselftest/arm64: mte: user_mem: Fix write() warning
Out of the box Ubuntu's 20.04 compiler warns about missing return value checks for write() (sys)calls. Make GCC happy by checking whether we actually managed to write "val". Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Mark Brown <broone@kernel.org> Link: https://lore.kernel.org/r/20210319165334.29213-5-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_user_mem.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/tools/testing/selftests/arm64/mte/check_user_mem.c b/tools/testing/selftests/arm64/mte/check_user_mem.c
index 4bfa80f2a8c3..1de7a0abd0ae 100644
--- a/tools/testing/selftests/arm64/mte/check_user_mem.c
+++ b/tools/testing/selftests/arm64/mte/check_user_mem.c
@@ -33,7 +33,8 @@ static int check_usermem_access_fault(int mem_type, int mode, int mapping)
if (fd == -1)
return KSFT_FAIL;
for (i = 0; i < len; i++)
- write(fd, &val, sizeof(val));
+ if (write(fd, &val, sizeof(val)) != sizeof(val))
+ return KSFT_FAIL;
lseek(fd, 0, 0);
ptr = mte_allocate_memory(len, mem_type, mapping, true);
if (check_allocated_memory(ptr, len, mem_type, true) != KSFT_PASS) {