Skip to content

Commit d82aa5d

Browse files
brooniectmarinas
authored andcommitted
kselftest/arm64: Don't open code SVE_PT_SIZE() in fp-ptrace
In fp-trace when allocating a buffer to write SVE register data we open code the addition of the header size to the VL depeendent register data size, which lead to an underallocation bug when we cut'n'pasted the code for FPSIMD format writes. Use the SVE_PT_SIZE() macro that the kernel UAPI provides for this. Fixes: b84d2b2 ("kselftest/arm64: Test FPSIMD format data writes via NT_ARM_SVE in fp-ptrace") Signed-off-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent ceca927 commit d82aa5d

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

tools/testing/selftests/arm64/fp/fp-ptrace.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1187,7 +1187,7 @@ static void sve_write_sve(pid_t child, struct test_config *config)
11871187
if (!vl)
11881188
return;
11891189

1190-
iov.iov_len = SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq, SVE_PT_REGS_SVE);
1190+
iov.iov_len = SVE_PT_SIZE(vq, SVE_PT_REGS_SVE);
11911191
iov.iov_base = malloc(iov.iov_len);
11921192
if (!iov.iov_base) {
11931193
ksft_print_msg("Failed allocating %lu byte SVE write buffer\n",
@@ -1234,8 +1234,7 @@ static void sve_write_fpsimd(pid_t child, struct test_config *config)
12341234
if (!vl)
12351235
return;
12361236

1237-
iov.iov_len = SVE_PT_SVE_OFFSET + SVE_PT_SVE_SIZE(vq,
1238-
SVE_PT_REGS_FPSIMD);
1237+
iov.iov_len = SVE_PT_SIZE(vq, SVE_PT_REGS_FPSIMD);
12391238
iov.iov_base = malloc(iov.iov_len);
12401239
if (!iov.iov_base) {
12411240
ksft_print_msg("Failed allocating %lu byte SVE write buffer\n",

0 commit comments

Comments
 (0)