Source-Changes-HG archive

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

[src/trunk]: src/sys/compat/netbsd32 don't check the value of retval in netbs...



details:   https://anonhg.NetBSD.org/src/rev/1287713532aa
branches:  trunk
changeset: 968216:1287713532aa
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Jan 07 07:26:21 2020 +0000

description:
don't check the value of retval in netbsd32_mmap() if sys_mmap()
was not successful.

diffstat:

 sys/compat/netbsd32/netbsd32_vm.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (35 lines):

diff -r e7cd3a867ecc -r 1287713532aa sys/compat/netbsd32/netbsd32_vm.c
--- a/sys/compat/netbsd32/netbsd32_vm.c Tue Jan 07 06:42:26 2020 +0000
+++ b/sys/compat/netbsd32/netbsd32_vm.c Tue Jan 07 07:26:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: netbsd32_vm.c,v 1.1 2018/12/24 21:27:06 mrg Exp $      */
+/*     $NetBSD: netbsd32_vm.c,v 1.2 2020/01/07 07:26:21 mrg Exp $      */
 
 /*
  * Copyright (c) 1998, 2001, 2008, 2018 Matthew R. Green
@@ -29,7 +29,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_vm.c,v 1.1 2018/12/24 21:27:06 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_vm.c,v 1.2 2020/01/07 07:26:21 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -86,9 +86,13 @@
 #endif
 
        error = sys_mmap(l, &ua, retval);
-       if ((u_long)*retval > (u_long)UINT_MAX) {
-               printf("netbsd32_mmap: retval out of range: 0x%lx\n",
-                   (u_long)*retval);
+       if (error == 0 && (u_long)*retval > (u_long)UINT_MAX) {
+               const char *name = curlwp->l_name;
+
+               if (name == NULL)
+                       name = curproc->p_comm;
+               printf("netbsd32_mmap(%s:%u:%u): retval out of range: 0x%lx\n",
+                   name, curproc->p_pid, curlwp->l_lid, (u_long)*retval);
                /* Should try to recover and return an error here. */
        }
        return error;



Home | Main Index | Thread Index | Old Index