Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/x86/x86 modify code handling mismatch of nsegs in _...
details: https://anonhg.NetBSD.org/src/rev/31d1be1fcf60
branches: trunk
changeset: 355510:31d1be1fcf60
user: jdolecek <jdolecek%NetBSD.org@localhost>
date: Mon Jul 31 19:29:19 2017 +0000
description:
modify code handling mismatch of nsegs in _bus_dmamem_alloc_range() to
a KASSERT() - plain return leaks memory, and this condition should
never trigger unless there is bug in uvm_pglistalloc(), so it seems
to be waste to check this
other ports usually simply do not check this, with exception of arm,
which does even full cleanup (checks it and calls uvm_pglistfree())
diffstat:
sys/arch/x86/x86/bus_dma.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diffs (28 lines):
diff -r 79da0c2b97b1 -r 31d1be1fcf60 sys/arch/x86/x86/bus_dma.c
--- a/sys/arch/x86/x86/bus_dma.c Mon Jul 31 18:54:40 2017 +0000
+++ b/sys/arch/x86/x86/bus_dma.c Mon Jul 31 19:29:19 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bus_dma.c,v 1.76 2017/06/01 02:45:08 chs Exp $ */
+/* $NetBSD: bus_dma.c,v 1.77 2017/07/31 19:29:19 jdolecek Exp $ */
/*-
* Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.76 2017/06/01 02:45:08 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bus_dma.c,v 1.77 2017/07/31 19:29:19 jdolecek Exp $");
/*
* The following is included because _bus_dma_uiomove is derived from
@@ -249,8 +249,7 @@
segs[curseg].ds_len += PAGE_SIZE;
} else {
curseg++;
- if (curseg >= nsegs)
- return EFBIG;
+ KASSERT(curseg < nsegs);
segs[curseg].ds_addr = curaddr;
segs[curseg].ds_len = PAGE_SIZE;
}
Home |
Main Index |
Thread Index |
Old Index