[LTP] [PATCH 1/1] mmap20: Fix invalid address

Li Wang liwang@redhat.com
Thu Apr 6 04:59:13 CEST 2023


Hi Petr,

(1<<9) is also used by another flag on alpha, but it said not
linux-specific,
so I guess it won't be a problem (at least for now).
  alpha/include/uapi/asm/mman.h:#define _MAP_HASSEMAPHORE 0x0200

Reviewed-by: Li Wang <liwang@redhat.com>


On Tue, Apr 4, 2023 at 7:29 PM Petr Vorel <pvorel@suse.cz> wrote:

> 1 << 7 (0x80) is defined as MAP_LOCKED on ppc64le and mips.
> Use 1 << 9 (0x200), which looks to be unused on all archs.
>
> Fixes: 2764e9e6a ("mmap20: New test for mmap() with MAP_SHARED_VALIDATE")
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
> ---
> NOTE: (1 << 10) would work as well.
>
>  testcases/kernel/syscalls/mmap/mmap20.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/testcases/kernel/syscalls/mmap/mmap20.c
> b/testcases/kernel/syscalls/mmap/mmap20.c
> index c346df5d1..5269179e5 100644
> --- a/testcases/kernel/syscalls/mmap/mmap20.c
> +++ b/testcases/kernel/syscalls/mmap/mmap20.c
> @@ -20,7 +20,7 @@
>
>  #define TEST_FILE "file_to_mmap"
>  #define TEST_FILE_SIZE 1024
> -#define INVALID_FLAG (1 << 7)
> +#define INVALID_FLAG (1 << 9)
>
>  static int fd = -1;
>  static void *addr;
> --
> 2.40.0
>
>

-- 
Regards,
Li Wang


More information about the ltp mailing list