Module Name:    src
Committed By:   mlelstv
Date:           Sun Feb 25 14:35:31 UTC 2024

Modified Files:
        src/sys/arch/virt68k/virt68k: trap.c

Log Message:
Don't crash in copyin/copyout when a NULL pointer is passed.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/virt68k/virt68k/trap.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/virt68k/virt68k/trap.c
diff -u src/sys/arch/virt68k/virt68k/trap.c:1.2 src/sys/arch/virt68k/virt68k/trap.c:1.3
--- src/sys/arch/virt68k/virt68k/trap.c:1.2	Sat Jan 20 00:15:33 2024
+++ src/sys/arch/virt68k/virt68k/trap.c	Sun Feb 25 14:35:31 2024
@@ -1,4 +1,4 @@
-/*	$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $	*/
+/*	$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.2 2024/01/20 00:15:33 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: trap.c,v 1.3 2024/02/25 14:35:31 mlelstv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_execfmt.h"
@@ -554,7 +554,7 @@ trap(struct frame *fp, int type, unsigne
 
 		va = trunc_page((vaddr_t)v);
 
-		if (map == kernel_map && va == 0) {
+		if (map == kernel_map && va == 0 && onfault == 0) {
 			printf("trap: bad kernel %s access at 0x%x\n",
 			    (ftype & VM_PROT_WRITE) ? "read/write" :
 			    "read", v);

Reply via email to