Module Name:    src
Committed By:   jdolecek
Date:           Mon Jul 31 19:29:19 UTC 2017

Modified Files:
        src/sys/arch/x86/x86: bus_dma.c

Log Message:
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())


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/x86/x86/bus_dma.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/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.76 src/sys/arch/x86/x86/bus_dma.c:1.77
--- src/sys/arch/x86/x86/bus_dma.c:1.76	Thu Jun  1 02:45:08 2017
+++ src/sys/arch/x86/x86/bus_dma.c	Mon Jul 31 19:29:19 2017
@@ -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 @@ _bus_dmamem_alloc_range(bus_dma_tag_t t,
 			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;
 		}

Reply via email to