Skip to content

Commit 7c942f8

Browse files
Dev Jainakpm00
authored andcommitted
selftests/mm: fix validate_addr() helper
validate_addr() checks whether the address returned by mmap() lies in the low or high VA space, according to whether a high addr hint was passed or not. The fix commit mentioned below changed the code in such a way that this function will always return failure when passed high_addr == 1; addr will be >= HIGH_ADDR_MARK always, we will fall down to "if (addr > HIGH_ADDR_MARK)" and return failure. Fix this. Link: https://lkml.kernel.org/r/[email protected] Fixes: d1d86ce ("selftests/mm: virtual_address_range: conform to TAP format output") Signed-off-by: Dev Jain <[email protected]> Reviewed-by: Donet Tom <[email protected]> Acked-by: David Hildenbrand <[email protected]> Cc: Anshuman Khandual <[email protected]> Cc: Lorenzo Stoakes <[email protected]> Cc: Ryan Roberts <[email protected]> Cc: Shuah Khan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent b6f5e74 commit 7c942f8

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

tools/testing/selftests/mm/virtual_address_range.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,11 @@ static void validate_addr(char *ptr, int high_addr)
7777
{
7878
unsigned long addr = (unsigned long) ptr;
7979

80-
if (high_addr && addr < HIGH_ADDR_MARK)
81-
ksft_exit_fail_msg("Bad address %lx\n", addr);
80+
if (high_addr) {
81+
if (addr < HIGH_ADDR_MARK)
82+
ksft_exit_fail_msg("Bad address %lx\n", addr);
83+
return;
84+
}
8285

8386
if (addr > HIGH_ADDR_MARK)
8487
ksft_exit_fail_msg("Bad address %lx\n", addr);

0 commit comments

Comments
 (0)