Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
syscalls/read02: fix invalid buf parameter when testing for bad fds
The read02 testcases 1 and 2 are intended to check the handling of the read syscall with an invalid fd (should fail EBADF) and an fd which is a directory (should fail EISDIR). However a bug in the test code meant that it also passed a NULL pointer as the buffer argument, and so the test only succeeded because of the implementation detail that the kernel happens to check for the EBADF and EISDIR errors before it checks the buffer pointer validity for an EFAULT error. The 'buf' field in the test_case_t structure is supposed to be a pointer to the address of the buffer, but it was being initialised with the address of the buffer itself; fix this by adding the extra indirection via a new 'bufaddr' variable, so that the test is checking the condition it intends to and nothing more. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Acked-by: Jan Stancek <jstancek@redhat.com>
- Loading branch information