Module Name: src
Committed By: riastradh
Date: Wed Jul 6 00:40:28 UTC 2022
Modified Files:
src/sys/uvm: uvm_mmap.c
Log Message:
mmap(2): Assert size != 0 in non-anonymous case.
This is guaranteed by a test earlier; adding the assertion just makes
it clearer that it applies to the branch where we call fo_mmap -- no
functional change intended.
To generate a diff of this commit:
cvs rdiff -u -r1.181 -r1.182 src/sys/uvm/uvm_mmap.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/uvm/uvm_mmap.c
diff -u src/sys/uvm/uvm_mmap.c:1.181 src/sys/uvm/uvm_mmap.c:1.182
--- src/sys/uvm/uvm_mmap.c:1.181 Wed Jul 6 00:40:16 2022
+++ src/sys/uvm/uvm_mmap.c Wed Jul 6 00:40:28 2022
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_mmap.c,v 1.181 2022/07/06 00:40:16 riastradh Exp $ */
+/* $NetBSD: uvm_mmap.c,v 1.182 2022/07/06 00:40:28 riastradh Exp $ */
/*
* Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -46,7 +46,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.181 2022/07/06 00:40:16 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_mmap.c,v 1.182 2022/07/06 00:40:28 riastradh Exp $");
#include "opt_compat_netbsd.h"
#include "opt_pax.h"
@@ -368,6 +368,8 @@ sys_mmap(struct lwp *l, const struct sys
advice = UVM_ADV_NORMAL;
if ((flags & MAP_ANON) == 0) {
+ KASSERT(size != 0);
+
if ((fp = fd_getfile(fd)) == NULL)
return EBADF;