Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/tests/lib/libc/sys In the mmap_err test case, mmap the addre...



details:   https://anonhg.NetBSD.org/src/rev/73b8da19d42c
branches:  trunk
changeset: 364671:73b8da19d42c
user:      gson <gson%NetBSD.org@localhost>
date:      Tue Apr 05 15:59:22 2022 +0000

description:
In the mmap_err test case, mmap the address, not the address of the address.
Should fix PR kern/56780.

diffstat:

 tests/lib/libc/sys/t_mmap.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (36 lines):

diff -r a27794eebbae -r 73b8da19d42c tests/lib/libc/sys/t_mmap.c
--- a/tests/lib/libc/sys/t_mmap.c       Tue Apr 05 13:09:54 2022 +0000
+++ b/tests/lib/libc/sys/t_mmap.c       Tue Apr 05 15:59:22 2022 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: t_mmap.c,v 1.15 2022/04/05 13:09:54 gson Exp $ */
+/* $NetBSD: t_mmap.c,v 1.16 2022/04/05 15:59:22 gson Exp $ */
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -55,7 +55,7 @@
  * SUCH DAMAGE.
  */
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: t_mmap.c,v 1.15 2022/04/05 13:09:54 gson Exp $");
+__RCSID("$NetBSD: t_mmap.c,v 1.16 2022/04/05 15:59:22 gson Exp $");
 
 #include <sys/param.h>
 #include <sys/disklabel.h>
@@ -215,7 +215,7 @@
 
 ATF_TC_BODY(mmap_err, tc)
 {
-       size_t addr = SIZE_MAX;
+       void *addr = (void *)-1;
        void *map;
 
        errno = 0;
@@ -225,7 +225,7 @@
        ATF_REQUIRE(errno == EBADF);
 
        errno = 0;
-       map = mmap(&addr, page, PROT_READ, MAP_FIXED|MAP_PRIVATE, -1, 0);
+       map = mmap(addr, page, PROT_READ, MAP_FIXED|MAP_PRIVATE, -1, 0);
 
        ATF_REQUIRE(map == MAP_FAILED);
        ATF_REQUIRE_MSG(errno == EINVAL, "errno %d != EINVAL", errno);



Home | Main Index | Thread Index | Old Index