CVS commit: src

2012-12-03 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Dec  3 12:28:07 UTC 2012

Modified Files:
src/sbin/tunefs: tunefs.8
src/share/man/man4: wapbl.4

Log Message:
Document how to resize the WAPBL log size.
Based on patch by Edgar Fuß e...@math.uni-bonn.de.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sbin/tunefs/tunefs.8
cvs rdiff -u -r1.14 -r1.15 src/share/man/man4/wapbl.4

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

Modified files:

Index: src/sbin/tunefs/tunefs.8
diff -u src/sbin/tunefs/tunefs.8:1.41 src/sbin/tunefs/tunefs.8:1.42
--- src/sbin/tunefs/tunefs.8:1.41	Sun Apr  8 22:00:37 2012
+++ src/sbin/tunefs/tunefs.8	Mon Dec  3 12:28:06 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: tunefs.8,v 1.41 2012/04/08 22:00:37 wiz Exp $
+.\	$NetBSD: tunefs.8,v 1.42 2012/12/03 12:28:06 wiz Exp $
 .\
 .\ Copyright (c) 1983, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\ @(#)tunefs.8	8.3 (Berkeley) 5/3/95
 .\
-.Dd December 15, 2010
+.Dd December 3, 2012
 .Dt TUNEFS 8
 .Os
 .Sh NAME
@@ -102,7 +102,12 @@ The default journaling log file size is 
 .Xr wapbl 4 .
 Specifying a size of zero will cause the in-filesystem journaling log file
 to be removed the next time the filesystem is mounted.
-The size of an existing in-filesystem journaling log file can not be changed.
+The size of an existing in-filesystem journaling log file can not be changed
+directly.
+You need to first set the log file size to zero, then mount the
+filesystem without logging enabled (which will remove the log without
+creating a new one), unmount, set the size to the new value and finally
+re-mount with logging enabled.
 .It Fl m Ar minfree
 This value specifies the percentage of space held back
 from normal users; the minimum free space threshold.

Index: src/share/man/man4/wapbl.4
diff -u src/share/man/man4/wapbl.4:1.14 src/share/man/man4/wapbl.4:1.15
--- src/share/man/man4/wapbl.4:1.14	Thu Jul 26 04:30:26 2012
+++ src/share/man/man4/wapbl.4	Mon Dec  3 12:28:07 2012
@@ -1,6 +1,6 @@
-.\ $NetBSD: wapbl.4,v 1.14 2012/07/26 04:30:26 dholland Exp $
+.\ $NetBSD: wapbl.4,v 1.15 2012/12/03 12:28:07 wiz Exp $
 .\
-.\ Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
+.\ Copyright (c) 2008, 2009, 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
 .\
 .\ Redistribution and use in source and binary forms, with or without
@@ -24,7 +24,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd July 26, 2012
+.Dd December 3, 2012
 .Dt WAPBL 4
 .Os
 .Sh NAME
@@ -122,7 +122,11 @@ mount -o log /dev/wd0a /mnt
 .Ed
 .Pp
 will remove the log and then re-create it with the default size.
-This method can also be used to grow or shrink the size of the journal.
+This method can also be used to grow or shrink the size of the journal
+by first scheduling the log for removal, then mounting read-write, but
+with logging disabled (so no new log will be created), then unmounting
+again, setting the desired log size and finally re-mounting with logging
+enabled.
 .Pp
 With the journal,
 .Xr fsck 8



CVS commit: src

2012-12-03 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Mon Dec  3 13:53:29 UTC 2012

Modified Files:
src: Makefile
src/etc: Makefile
Added Files:
src/etc: Makefile.params

Log Message:
Add src/etc/Makefile.params, containing the definition of the
RELEASEVARS variable, and commands related to printing the values of
the variables whose names are in RELEASEVARS.

Add an awk script to remove noise printed by make -j or high levels
of MAKEVERBOSE, so we get only the variables names and values.  The
values are escaped so that variables containing embedded newlines,
quotation marks, and backslashes, are passed through safely.

Adapt src/etc/Makefile and src/Makefile to use the new ${PRINT_PARAMS}
command defined in src/etc/Makefile.params.

Now ${DESTDIR}/etc/release and the params file in the top-level
.OBJDIR should never contain unwanted noise, even after a build with
MAKEVERBOSE=4.


To generate a diff of this commit:
cvs rdiff -u -r1.301 -r1.302 src/Makefile
cvs rdiff -u -r1.400 -r1.401 src/etc/Makefile
cvs rdiff -u -r0 -r1.1 src/etc/Makefile.params

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

Modified files:

Index: src/Makefile
diff -u src/Makefile:1.301 src/Makefile:1.302
--- src/Makefile:1.301	Thu Nov 15 23:51:53 2012
+++ src/Makefile	Mon Dec  3 13:53:29 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.301 2012/11/15 23:51:53 joerg Exp $
+#	$NetBSD: Makefile,v 1.302 2012/12/03 13:53:29 apb Exp $
 
 #
 # This is the top-level makefile for building NetBSD. For an outline of
@@ -259,11 +259,11 @@ includes-gnu:	.PHONY includes-lib
 #
 # This is referenced by _NETBSD_VERSION_DEPENDS in bsd.own.mk.
 #
-
+.include ${NETBSDSRCDIR}/etc/Makefile.params
 CLEANDIRFILES+= params
 params: .EXEC
 	${_MKMSG_CREATE} params
-	@(${MAKEDIRTARGET:S/^@//} etc params) ${.TARGET}.new
+	@${PRINT_PARAMS} ${.TARGET}.new
 	@if cmp -s ${.TARGET}.new ${.TARGET}  /dev/null 21; then \
 		: params is unchanged ; \
 		rm ${.TARGET}.new ; \
@@ -273,6 +273,12 @@ params: .EXEC
 	fi
 
 #
+# Display current make(1) parameters
+#
+show-params: .PHONY .MAKE
+	@${PRINT_PARAMS}
+
+#
 # Build the system and install into DESTDIR.
 #
 
@@ -521,9 +527,3 @@ dependall-distrib depend-distrib all-dis
 .include bsd.obj.mk
 .include bsd.kernobj.mk
 .include bsd.subdir.mk
-
-#
-# Display current make(1) parameters
-#
-show-params: .PHONY .MAKE
-	${MAKEDIRTARGET} etc params

Index: src/etc/Makefile
diff -u src/etc/Makefile:1.400 src/etc/Makefile:1.401
--- src/etc/Makefile:1.400	Sun Nov  4 11:09:14 2012
+++ src/etc/Makefile	Mon Dec  3 13:53:28 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.400 2012/11/04 11:09:14 apb Exp $
+#	$NetBSD: Makefile,v 1.401 2012/12/03 13:53:28 apb Exp $
 #	from: @(#)Makefile	8.7 (Berkeley) 5/25/95
 
 # Environment variables without default values:
@@ -186,40 +186,7 @@ MAKEDEV: ${.CURDIR}/MAKEDEV.awk ${.CURDI
 	${TOOL_AWK} -f ${.CURDIR}/MAKEDEV.awk ${.CURDIR}/MAKEDEV.tmpl \
 	 ${.TARGET}
 
-RELEASEVARS=	BSDOBJDIR BSDSRCDIR BUILDID \
-		DESTDIR DISTRIBVER EXTERNAL_TOOLCHAIN HAVE_GCC HAVE_GDB \
-		INSTALLWORLDDIR \
-		KERNARCHDIR KERNCONFDIR KERNOBJDIR KERNSRCDIR \
-		MACHINE MACHINE_ARCH MAKE MAKECONF MAKEFLAGS \
-		MAKEOBJDIR MAKEOBJDIRPREFIX MAKEVERBOSE \
-		MKBFD MKBINUTILS MKCATPAGES \
-		MKCRYPTO MKCRYPTO_RC5 MKCVS \
-		MKDEBUG MKDEBUGLIB MKDOC MKDTRACE MKDYNAMICROOT \
-		MKGCC MKGCCCMDS MKGDB \
-		MKHESIOD MKHTML MKIEEEFP MKINET6 MKINFO MKIPFILTER \
-		MKKERBEROS MKLDAP MKLINKLIB MKLINT \
-		MKMAN MKMANZ MKMDNS MKNLS MKNPF MKOBJ MKOBJDIRS \
-		MKPAM MKPF MKPIC MKPICINSTALL MKPICLIB MKPOSTFIX MKPROFILE \
-		MKSHARE MKSKEY MKSOFTFLOAT MKSTATICLIB \
-		MKUNPRIVED MKUPDATE MKX11 MKYP \
-		NBUILDJOBS NETBSDSRCDIR \
-		NOCLEANDIR NODISTRIBDIRS NOINCLUDES \
-		OBJMACHINE \
-		RELEASEDIR RELEASEMACHINEDIR TOOLCHAIN_MISSING TOOLDIR \
-		USE_HESIOD USE_INET6 USE_JEMALLOC USE_KERBEROS USE_LDAP \
-		USE_PAM USE_SKEY USE_YP \
-		USETOOLS USR_OBJMACHINE \
-		X11SRCDIR X11FLAVOUR
-
-params: .PHONY
-.for var in ${RELEASEVARS}
-.if defined(${var})
-	@printf %20s = '%-s'\n ${var} ${${var}:Q}
-.else
-	@printf %20s = (undefined)\n ${var}
-.endif
-.endfor
-
+.include ${NETBSDSRCDIR}/etc/Makefile.params
 CLEANFILES+=	etc-release
 etc-release: .EXEC .MAKE
 	${_MKTARGET_CREATE}
@@ -231,7 +198,7 @@ etc-release: .EXEC .MAKE
 		printf %20s   %s\n  Build date $$(date -u); \
 		printf %20s   %s\n  Built by $${USER-root}@$$(hostname); \
 		echo ; \
-		(cd ${.CURDIR}; ${MAKE} ${MFLAGS} -j1 params); \
+		${PRINT_PARAMS} ; \
 	) ${.OBJDIR}/${.TARGET}
 
 install-etc-release: .PHONY etc-release

Added files:

Index: src/etc/Makefile.params
diff -u /dev/null src/etc/Makefile.params:1.1
--- /dev/null	Mon Dec  3 13:53:29 2012
+++ src/etc/Makefile.params	Mon Dec  3 13:53:28 2012
@@ -0,0 +1,149 @@
+#	$NetBSD: Makefile.params,v 1.1 2012/12/03 13:53:28 apb Exp $
+#
+# Makefile fragment for printing build parameters.
+#
+# Public variables:
+#	RELEASEVARS
+#		List of 

CVS commit: src/crypto/external/bsd/netpgp/dist/src/libbn

2012-12-03 Thread Alistair G. Crooks
Module Name:src
Committed By:   agc
Date:   Mon Dec  3 18:02:22 UTC 2012

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/libbn: bn.h

Log Message:
Make the mp_digit type an unsigned long so that it works for ILP32 and
LP64.

Fixes problems showing up on regression tests on i386 (which work fine on
amd64) i.e. turn:

t_netpgpverify (1/1): 2 test cases
netpgpverify_dsa: [0.309746s] Failed: atf-check failed; see the 
output of the test for details
netpgpverify_rsa: [0.183148s] Passed.
[0.495102s]

Failed test cases:
t_netpgpverify:netpgpverify_dsa

Summary for 1 test programs:
1 passed test cases.
1 failed test cases.
0 expected failed test cases.
0 skipped test cases.

into:

t_netpgpverify (1/1): 2 test cases
netpgpverify_dsa: [0.236076s] Passed.
netpgpverify_rsa: [0.154680s] Passed.
[0.393034s]

Summary for 1 test programs:
2 passed test cases.
0 failed test cases.
0 expected failed test cases.
0 skipped test cases.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h

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

Modified files:

Index: src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h
diff -u src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h:1.3 src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h:1.4
--- src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h:1.3	Tue Nov 20 17:57:40 2012
+++ src/crypto/external/bsd/netpgp/dist/src/libbn/bn.h	Mon Dec  3 18:02:22 2012
@@ -44,7 +44,8 @@
 
 __BEGIN_DECLS
 
-typedef uint64_t	mp_digit;
+/* should be 32bit on ILP32, 64bit on LP64 */
+typedef unsigned long	mp_digit;
 typedef uint64_t	mp_word;
 
 /* multi-precision integer */



CVS commit: [matt-nb6-plus] src/gnu/usr.bin

2012-12-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Dec  3 18:28:23 UTC 2012

Modified Files:
src/gnu/usr.bin [matt-nb6-plus]: Makefile

Log Message:
Fix check of binutils to use right version.


To generate a diff of this commit:
cvs rdiff -u -r1.135.6.1 -r1.135.6.2 src/gnu/usr.bin/Makefile

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

Modified files:

Index: src/gnu/usr.bin/Makefile
diff -u src/gnu/usr.bin/Makefile:1.135.6.1 src/gnu/usr.bin/Makefile:1.135.6.2
--- src/gnu/usr.bin/Makefile:1.135.6.1	Tue Nov 20 18:52:37 2012
+++ src/gnu/usr.bin/Makefile	Mon Dec  3 18:28:22 2012
@@ -1,9 +1,9 @@
-#	$NetBSD: Makefile,v 1.135.6.1 2012/11/20 18:52:37 matt Exp $
+#	$NetBSD: Makefile,v 1.135.6.2 2012/12/03 18:28:22 matt Exp $
 
 .include bsd.own.mk
 
 SUBDIR+=	bc
-.if ${MKBINUTILS} != no  ${HAVE_BINUTILS} == 219
+.if ${MKBINUTILS} != no  ${HAVE_BINUTILS} == 216
 SUBDIR+=	binutils
 .endif
 SUBDIR+=	c89 c99



CVS commit: src/sys/external/bsd/ipf/netinet

2012-12-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  3 18:30:25 UTC 2012

Modified Files:
src/sys/external/bsd/ipf/netinet: ip_dstlist.c

Log Message:
PR/47270: Paul Goyette: ipftest -N aborts
1. check for NULL before de-refencing; in particular sel is assigned to NULL,
   in the default case, and then couple of lines down we do sel-
2. gcc appears to optimize u_32_t hash[4], to u_32_t hash, since we only
   use hash[0], disregarding the fact that we pass it to MD5Final() leading
   to stack corruption. Use an explicit union, so that the compiler stops
   butting its head where it shouldn't.

XXX: pullup to 6


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/ipf/netinet/ip_dstlist.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/external/bsd/ipf/netinet/ip_dstlist.c
diff -u src/sys/external/bsd/ipf/netinet/ip_dstlist.c:1.4 src/sys/external/bsd/ipf/netinet/ip_dstlist.c:1.5
--- src/sys/external/bsd/ipf/netinet/ip_dstlist.c:1.4	Sun Jul 22 12:31:26 2012
+++ src/sys/external/bsd/ipf/netinet/ip_dstlist.c	Mon Dec  3 13:30:25 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_dstlist.c,v 1.4 2012/07/22 16:31:26 darrenr Exp $	*/
+/*	$NetBSD: ip_dstlist.c,v 1.5 2012/12/03 18:30:25 christos Exp $	*/
 
 /*
  * Copyright (C) 2012 by Darren Reed.
@@ -1076,12 +1076,15 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 {
 	ipf_dstnode_t *node, *sel;
 	int connects;
-	u_32_t hash[4];
+	union {
+	u_32_t hash[4];
+	unsigned char bytes[16];
+	} h;
 	MD5_CTX ctx;
 	int family;
 	int x;
 
-	if (d-ipld_dests == NULL || *d-ipld_dests == NULL)
+	if (d == NULL || d-ipld_dests == NULL || *d-ipld_dests == NULL)
 		return NULL;
 
 	family = fin-fin_family;
@@ -1139,8 +1142,8 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 			  sizeof(fin-fin_src6));
 		MD5Update(ctx, (u_char *)fin-fin_dst6,
 			  sizeof(fin-fin_dst6));
-		MD5Final((u_char *)hash, ctx);
-		x = hash[0] % d-ipld_nodes;
+		MD5Final(h.bytes, ctx);
+		x = h.hash[0] % d-ipld_nodes;
 		sel = d-ipld_dests[x];
 		break;
 
@@ -1149,8 +1152,8 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 		MD5Update(ctx, (u_char *)d-ipld_seed, sizeof(d-ipld_seed));
 		MD5Update(ctx, (u_char *)fin-fin_src6,
 			  sizeof(fin-fin_src6));
-		MD5Final((u_char *)hash, ctx);
-		x = hash[0] % d-ipld_nodes;
+		MD5Final(h.bytes, ctx);
+		x = h.hash[0] % d-ipld_nodes;
 		sel = d-ipld_dests[x];
 		break;
 
@@ -1159,8 +1162,8 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 		MD5Update(ctx, (u_char *)d-ipld_seed, sizeof(d-ipld_seed));
 		MD5Update(ctx, (u_char *)fin-fin_dst6,
 			  sizeof(fin-fin_dst6));
-		MD5Final((u_char *)hash, ctx);
-		x = hash[0] % d-ipld_nodes;
+		MD5Final(h.bytes, ctx);
+		x = h.hash[0] % d-ipld_nodes;
 		sel = d-ipld_dests[x];
 		break;
 
@@ -1169,7 +1172,7 @@ ipf_dstlist_select(fr_info_t *fin, ippoo
 		break;
 	}
 
-	if (sel-ipfd_dest.fd_addr.adf_family != family)
+	if (sel  sel-ipfd_dest.fd_addr.adf_family != family)
 		sel = NULL;
 	d-ipld_selected = sel;
 



CVS commit: [matt-nb6-plus] src/gnu/dist/binutils/gas/config

2012-12-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Dec  3 18:44:42 UTC 2012

Modified Files:
src/gnu/dist/binutils/gas/config [matt-nb6-plus]: tc-arm.c

Log Message:
Remove return values from void functions.  (cp error)


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.3 -r1.6.6.4 src/gnu/dist/binutils/gas/config/tc-arm.c

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

Modified files:

Index: src/gnu/dist/binutils/gas/config/tc-arm.c
diff -u src/gnu/dist/binutils/gas/config/tc-arm.c:1.6.6.3 src/gnu/dist/binutils/gas/config/tc-arm.c:1.6.6.4
--- src/gnu/dist/binutils/gas/config/tc-arm.c:1.6.6.3	Wed Nov 21 08:52:09 2012
+++ src/gnu/dist/binutils/gas/config/tc-arm.c	Mon Dec  3 18:44:40 2012
@@ -6803,7 +6803,7 @@ do_bfci (char * str)
   if (expr.X_op != O_constant)
 {
   inst.error = _(constant expression expected);
-  return FAIL;
+  return;
 }
 
   lsb = expr.X_add_number;
@@ -6830,7 +6830,7 @@ do_bfci (char * str)
   if (expr.X_op != O_constant)
 {
   inst.error = _(constant expression expected);
-  return FAIL;
+  return;
 }
 
   width = expr.X_add_number;
@@ -6885,7 +6885,7 @@ do_bfx (char * str)
   if (expr.X_op != O_constant)
 {
   inst.error = _(constant expression expected);
-  return FAIL;
+  return;
 }
 
   lsb = expr.X_add_number;



CVS commit: [netbsd-6] src/lib/libpthread

2012-12-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Mon Dec  3 19:07:27 UTC 2012

Modified Files:
src/lib/libpthread [netbsd-6]: pthread.c

Log Message:
Apply patch (requested by riastradh in ticket #735) to fix the unchecked
assumption that sizeof(struct __pthread_st) = pagesize, as observed in
PR 47271.


To generate a diff of this commit:
cvs rdiff -u -r1.125.4.1 -r1.125.4.2 src/lib/libpthread/pthread.c

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

Modified files:

Index: src/lib/libpthread/pthread.c
diff -u src/lib/libpthread/pthread.c:1.125.4.1 src/lib/libpthread/pthread.c:1.125.4.2
--- src/lib/libpthread/pthread.c:1.125.4.1	Mon May  7 03:12:33 2012
+++ src/lib/libpthread/pthread.c	Mon Dec  3 19:07:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pthread.c,v 1.125.4.1 2012/05/07 03:12:33 riz Exp $	*/
+/*	$NetBSD: pthread.c,v 1.125.4.2 2012/12/03 19:07:26 jdc Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002, 2003, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: pthread.c,v 1.125.4.1 2012/05/07 03:12:33 riz Exp $);
+__RCSID($NetBSD: pthread.c,v 1.125.4.2 2012/12/03 19:07:26 jdc Exp $);
 
 #define	__EXPOSE_STACK	1
 
@@ -1274,22 +1274,32 @@ pthread__stackid_setup(void *base, size_
 {
 	pthread_t t;
 	void *redaddr;
-	size_t pagesize;
+	size_t pagesize, bytes_needed;
 	int ret;
 
 	t = base;
 	pagesize = (size_t)sysconf(_SC_PAGESIZE);
+	bytes_needed = roundup(sizeof(*t), pagesize);
+
+	if (pagesize = size)
+		return ENOMEM;
+	if (bytes_needed = (size - pagesize))
+		return ENOMEM;
 
 	/*
 	 * Put a pointer to the pthread in the bottom (but
  * redzone-protected section) of the stack. 
+	 *
+	 * XXX If the stack grows up, the pthread is *not*
+	 * protected by the redzone.
 	 */
-	redaddr = STACK_SHRINK(STACK_MAX(base, size), pagesize);
-	t-pt_stack.ss_size = size - 2 * pagesize;
+	t-pt_stack.ss_size = size - bytes_needed - pagesize;
 #ifdef __MACHINE_STACK_GROWS_UP
-	t-pt_stack.ss_sp = (char *)(void *)base + pagesize;
+	redaddr = STACK_SHRINK(STACK_MAX(base, size), pagesize);
+	t-pt_stack.ss_sp = (char *)(void *)base + bytes_needed;
 #else
-	t-pt_stack.ss_sp = (char *)(void *)base + 2 * pagesize;
+	redaddr = STACK_SHRINK(STACK_MAX(base, size), bytes_needed);
+	t-pt_stack.ss_sp = (char *)(void *)base + bytes_needed + pagesize;
 #endif
 	/* Protect the next-to-bottom stack page as a red zone. */
 	ret = mprotect(redaddr, pagesize, PROT_NONE);



CVS commit: src/tests/ipf/expected

2012-12-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  3 19:35:33 UTC 2012

Modified Files:
src/tests/ipf/expected: i14

Log Message:
For rules without any address, don't infer an address family.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/ipf/expected/i14

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

Modified files:

Index: src/tests/ipf/expected/i14
diff -u src/tests/ipf/expected/i14:1.4 src/tests/ipf/expected/i14:1.5
--- src/tests/ipf/expected/i14:1.4	Fri Mar 23 23:08:00 2012
+++ src/tests/ipf/expected/i14	Mon Dec  3 19:35:33 2012
@@ -1,5 +1,5 @@
 block in on eri0(!) all head 1
-pass in on eri0(!) inet proto icmp from any to any group 1
+pass in on eri0(!) proto icmp from any to any group 1
 pass out on ed0(!) all head 100
 block out on ed0(!) proto udp from any to any group 100
 block in on vm0(!) proto tcp/udp from any to any head 101



CVS commit: src/tests/ipf/expected

2012-12-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  3 19:42:00 UTC 2012

Modified Files:
src/tests/ipf/expected: i19.dist

Log Message:
Without explicit address, the address family is not inferred and not
displayed in the output.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/tests/ipf/expected/i19.dist

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

Modified files:

Index: src/tests/ipf/expected/i19.dist
diff -u src/tests/ipf/expected/i19.dist:1.4 src/tests/ipf/expected/i19.dist:1.5
--- src/tests/ipf/expected/i19.dist:1.4	Fri Mar 23 23:08:00 2012
+++ src/tests/ipf/expected/i19.dist	Mon Dec  3 19:42:00 2012
@@ -1,22 +1,22 @@
-block in log level user.debug quick inet proto icmp from any to any
-block in log level mail.info quick inet proto icmp from any to any
-block in log level daemon.notice quick inet proto icmp from any to any
-block in log level auth.warn quick inet proto icmp from any to any
-block in log level syslog.err quick inet proto icmp from any to any
-block in log level lpr.crit quick inet proto icmp from any to any
-block in log level news.alert quick inet proto icmp from any to any
-block in log level uucp.emerg quick inet proto icmp from any to any
-block in log level cron.debug quick inet proto icmp from any to any
-block in log level ftp.info quick inet proto icmp from any to any
-block in log level authpriv.notice quick inet proto icmp from any to any
-block in log level logalert.warn quick inet proto icmp from any to any
-block in log level local0.err quick inet proto icmp from any to any
-block in log level local1.crit quick inet proto icmp from any to any
-block in log level local2.alert quick inet proto icmp from any to any
-block in log level local3.emerg quick inet proto icmp from any to any
-block in log level local4.debug quick inet proto icmp from any to any
-block in log level local5.info quick inet proto icmp from any to any
-block in log level local6.notice quick inet proto icmp from any to any
-block in log level local7.warn quick inet proto icmp from any to any
-block in log level kern.err quick inet proto icmp from any to any
-block in log level security.emerg quick inet proto icmp from any to any
+block in log level user.debug quick proto icmp from any to any
+block in log level mail.info quick proto icmp from any to any
+block in log level daemon.notice quick proto icmp from any to any
+block in log level auth.warn quick proto icmp from any to any
+block in log level syslog.err quick proto icmp from any to any
+block in log level lpr.crit quick proto icmp from any to any
+block in log level news.alert quick proto icmp from any to any
+block in log level uucp.emerg quick proto icmp from any to any
+block in log level cron.debug quick proto icmp from any to any
+block in log level ftp.info quick proto icmp from any to any
+block in log level authpriv.notice quick proto icmp from any to any
+block in log level logalert.warn quick proto icmp from any to any
+block in log level local0.err quick proto icmp from any to any
+block in log level local1.crit quick proto icmp from any to any
+block in log level local2.alert quick proto icmp from any to any
+block in log level local3.emerg quick proto icmp from any to any
+block in log level local4.debug quick proto icmp from any to any
+block in log level local5.info quick proto icmp from any to any
+block in log level local6.notice quick proto icmp from any to any
+block in log level local7.warn quick proto icmp from any to any
+block in log level kern.err quick proto icmp from any to any
+block in log level security.emerg quick proto icmp from any to any



CVS commit: src/tests/ipf

2012-12-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  3 19:43:36 UTC 2012

Modified Files:
src/tests/ipf: t_filter_parse.sh

Log Message:
Now that expected output files have been adjusted, we can remove the
expectation that tests i14 and i19 will fail.

Should address kern/47262 which will be closed.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/tests/ipf/t_filter_parse.sh

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

Modified files:

Index: src/tests/ipf/t_filter_parse.sh
diff -u src/tests/ipf/t_filter_parse.sh:1.8 src/tests/ipf/t_filter_parse.sh:1.9
--- src/tests/ipf/t_filter_parse.sh:1.8	Sat Dec  1 04:19:24 2012
+++ src/tests/ipf/t_filter_parse.sh	Mon Dec  3 19:43:36 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_filter_parse.sh,v 1.8 2012/12/01 04:19:24 pgoyette Exp $
+# $NetBSD: t_filter_parse.sh,v 1.9 2012/12/03 19:43:36 pgoyette Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -96,12 +96,12 @@ test_case i10 itest text ipf
 test_case i11 itest text ipf
 test_case i12 itest text ipf
 test_case i13 itest text ipf
-failing_test_case i14 itest PR kern/47262 Proto-family missing from logs text ipf
+test_case i14 itest text ipf
 test_case i15 itest text ipf
 test_case i16 itest text ipf
 test_case i17 itest text ipftest
 test_case i18 itest text ipf
-failing_test_case i19 itest_i19 PR kern/47262 Proto-family missing from logs text ipf
+test_case i19 itest_i19 PR kern/47262 Proto-family missing from logs text ipf
 test_case i20 itest text ipf
 test_case i21 itest text ipf
 test_case i22 itest text ipf



CVS commit: src/tests/ipf

2012-12-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  3 20:43:59 UTC 2012

Modified Files:
src/tests/ipf/expected: i14
src/tests/ipf/regress: i14

Log Message:
Include an explicit test for correctly inferring family inet6 when there
is an IPv6 address in the rule


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/tests/ipf/expected/i14
cvs rdiff -u -r1.4 -r1.5 src/tests/ipf/regress/i14

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

Modified files:

Index: src/tests/ipf/expected/i14
diff -u src/tests/ipf/expected/i14:1.5 src/tests/ipf/expected/i14:1.6
--- src/tests/ipf/expected/i14:1.5	Mon Dec  3 19:35:33 2012
+++ src/tests/ipf/expected/i14	Mon Dec  3 20:43:59 2012
@@ -10,3 +10,4 @@ block in on vm0(!) proto tcp/udp from an
 pass in inet proto tcp/udp from 1.1.1.1/32 to 2.2.2.2/32 group vm0-group
 block in on vm0(!) proto tcp/udp from any to any head vm0-group
 pass in inet proto tcp/udp from 1.1.1.1/32 to 2.2.2.2/32 group vm0-group
+pass in inet6 from 8f::/128 to f8::/128

Index: src/tests/ipf/regress/i14
diff -u src/tests/ipf/regress/i14:1.4 src/tests/ipf/regress/i14:1.5
--- src/tests/ipf/regress/i14:1.4	Fri Mar 23 23:08:03 2012
+++ src/tests/ipf/regress/i14	Mon Dec  3 20:43:59 2012
@@ -10,3 +10,4 @@ block in on vm0 proto tcp/udp all head v
 pass in from 1.1.1.1 to 2.2.2.2 group vm0-group
 block in on vm0 proto tcp/udp all head vm0-group
 pass in from 1.1.1.1 to 2.2.2.2 group vm0-group
+pass in from 8f:: to f8::



CVS commit: src/tests/ipf

2012-12-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  3 21:29:16 UTC 2012

Modified Files:
src/tests/ipf/expected: i14
src/tests/ipf/regress: i14

Log Message:
Add a couple more inet6 tests to verify correct rule parsing


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/ipf/expected/i14
cvs rdiff -u -r1.5 -r1.6 src/tests/ipf/regress/i14

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

Modified files:

Index: src/tests/ipf/expected/i14
diff -u src/tests/ipf/expected/i14:1.6 src/tests/ipf/expected/i14:1.7
--- src/tests/ipf/expected/i14:1.6	Mon Dec  3 20:43:59 2012
+++ src/tests/ipf/expected/i14	Mon Dec  3 21:29:16 2012
@@ -11,3 +11,5 @@ pass in inet proto tcp/udp from 1.1.1.1/
 block in on vm0(!) proto tcp/udp from any to any head vm0-group
 pass in inet proto tcp/udp from 1.1.1.1/32 to 2.2.2.2/32 group vm0-group
 pass in inet6 from 8f::/128 to f8::/128
+block in inet6 proto udp from any to any
+block in inet6 all

Index: src/tests/ipf/regress/i14
diff -u src/tests/ipf/regress/i14:1.5 src/tests/ipf/regress/i14:1.6
--- src/tests/ipf/regress/i14:1.5	Mon Dec  3 20:43:59 2012
+++ src/tests/ipf/regress/i14	Mon Dec  3 21:29:15 2012
@@ -11,3 +11,5 @@ pass in from 1.1.1.1 to 2.2.2.2 group vm
 block in on vm0 proto tcp/udp all head vm0-group
 pass in from 1.1.1.1 to 2.2.2.2 group vm0-group
 pass in from 8f:: to f8::
+block in inet6 proto udp
+block in inet6



CVS commit: [matt-nb6-plus] src/sys/dev/ic

2012-12-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Mon Dec  3 22:00:53 UTC 2012

Modified Files:
src/sys/dev/ic [matt-nb6-plus]: ahcisata_core.c

Log Message:
Pullup changes in rev 1.44.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.4.1 src/sys/dev/ic/ahcisata_core.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/dev/ic/ahcisata_core.c
diff -u src/sys/dev/ic/ahcisata_core.c:1.33 src/sys/dev/ic/ahcisata_core.c:1.33.4.1
--- src/sys/dev/ic/ahcisata_core.c:1.33	Tue Jan 10 01:43:05 2012
+++ src/sys/dev/ic/ahcisata_core.c	Mon Dec  3 22:00:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ahcisata_core.c,v 1.33 2012/01/10 01:43:05 jakllsch Exp $	*/
+/*	$NetBSD: ahcisata_core.c,v 1.33.4.1 2012/12/03 22:00:53 matt Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.33 2012/01/10 01:43:05 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: ahcisata_core.c,v 1.33.4.1 2012/12/03 22:00:53 matt Exp $);
 
 #include sys/types.h
 #include sys/malloc.h
@@ -686,11 +686,12 @@ ahci_probe_drive(struct ata_channel *chp
 		splx(s);
 		/* clear port interrupt register */
 		AHCI_WRITE(sc, AHCI_P_IS(chp-ch_channel), 0x);
+		
 		/* and enable interrupts */
 		AHCI_WRITE(sc, AHCI_P_IE(chp-ch_channel),
 		AHCI_P_IX_TFES | AHCI_P_IX_HBFS | AHCI_P_IX_IFS |
 		AHCI_P_IX_OFS | AHCI_P_IX_DPS | AHCI_P_IX_UFS |
-		AHCI_P_IX_DHRS);
+		AHCI_P_IX_PSS | AHCI_P_IX_DHRS);
 		/* wait 500ms before actually starting operations */
 		tsleep(sc, PRIBIO, ahciprb, mstohz(500));
 		break;
@@ -769,8 +770,9 @@ ahci_cmd_start(struct ata_channel *chp, 
 	int i;
 	int channel = chp-ch_channel;
 
-	AHCIDEBUG_PRINT((ahci_cmd_start CI 0x%x\n,
-	AHCI_READ(sc, AHCI_P_CI(chp-ch_channel))), DEBUG_XFERS);
+	AHCIDEBUG_PRINT((ahci_cmd_start CI 0x%x timo %d\n,
+	AHCI_READ(sc, AHCI_P_CI(chp-ch_channel)), ata_c-timeout),
+	DEBUG_XFERS);
 
 	cmd_tbl = achp-ahcic_cmd_tbl[slot];
 	AHCIDEBUG_PRINT((%s port %d tbl %p\n, AHCINAME(sc), chp-ch_channel,
@@ -912,18 +914,18 @@ ahci_cmd_done(struct ata_channel *chp, s
 	uint16_t *idwordbuf;
 	int i;
 
-	AHCIDEBUG_PRINT((ahci_cmd_done channel %d\n, chp-ch_channel),
-	DEBUG_FUNCS);
+	AHCIDEBUG_PRINT((ahci_cmd_done channel %d (status %#x) flags %#x/%#x\n,
+	chp-ch_channel, chp-ch_status, xfer-c_flags, ata_c-flags), DEBUG_FUNCS);
 
 	/* this comamnd is not active any more */
 	achp-ahcic_cmds_active = ~(1  slot);
 
 	if (ata_c-flags  (AT_READ|AT_WRITE)  ata_c-bcount  0) {
-		bus_dmamap_sync(sc-sc_dmat, achp-ahcic_datad[slot], 0,
-		achp-ahcic_datad[slot]-dm_mapsize,
+		bus_dmamap_t map = achp-ahcic_datad[slot];
+		bus_dmamap_sync(sc-sc_dmat, map, 0, map-dm_mapsize,
 		(ata_c-flags  AT_READ) ? BUS_DMASYNC_POSTREAD :
 		BUS_DMASYNC_POSTWRITE);
-		bus_dmamap_unload(sc-sc_dmat, achp-ahcic_datad[slot]);
+		bus_dmamap_unload(sc-sc_dmat, map);
 	}
 
 	AHCI_CMDH_SYNC(sc, achp, slot,
@@ -1192,8 +1194,12 @@ ahci_timeout(void *v)
 {
 	struct ata_channel *chp = (struct ata_channel *)v;
 	struct ata_xfer *xfer = chp-ch_queue-active_xfer;
+#ifdef AHCI_DEBUG
+	struct ahci_softc *sc = (struct ahci_softc *)chp-ch_atac;
+#endif
 	int s = splbio();
-	AHCIDEBUG_PRINT((ahci_timeout xfer %p\n, xfer), DEBUG_INTR);
+	AHCIDEBUG_PRINT((ahci_timeout xfer %p intr %#x\n, xfer, AHCI_READ(sc, AHCI_P_IS(chp-ch_channel))), DEBUG_INTR);
+	
 	if ((chp-ch_flags  ATACH_IRQ_WAIT) != 0) {
 		xfer-c_flags |= C_TIMEOU;
 		xfer-c_intr(chp, xfer, 0);



CVS commit: src/sys/arch/evbarm/conf

2012-12-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Dec  3 23:38:30 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: SHEEVAPLUG

Log Message:
- Add MSGBUFSIZE=32768 because 4K is very small
- Add commented out entry for MVGBE_EVENT_COUNTERS
- Comment out COPTS=-O1
- Enable mvpex, pci and pchb to share with OPENRD
- Enable mvsata to share with DREAMPLUG
- Enable mvsocgpp, gpio, atabus and wd


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/evbarm/conf/SHEEVAPLUG

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/evbarm/conf/SHEEVAPLUG
diff -u src/sys/arch/evbarm/conf/SHEEVAPLUG:1.25 src/sys/arch/evbarm/conf/SHEEVAPLUG:1.26
--- src/sys/arch/evbarm/conf/SHEEVAPLUG:1.25	Wed Oct 17 14:48:10 2012
+++ src/sys/arch/evbarm/conf/SHEEVAPLUG	Mon Dec  3 23:38:29 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: SHEEVAPLUG,v 1.25 2012/10/17 14:48:10 apb Exp $
+#	$NetBSD: SHEEVAPLUG,v 1.26 2012/12/03 23:38:29 msaitoh Exp $
 #
 #  This configuration supports for generically Marvell SheevaPlug
 #
@@ -27,6 +27,7 @@ options 	KIRKWOOD
 
 # Standard system options
 
+options 	MSGBUFSIZE=32768
 options 	RTC_OFFSET=0	# hardware clock is this many mins. west of GMT
 #options 	NTP		# NTP phase/frequency locked loop
 
@@ -95,6 +96,7 @@ options 	INET6		# IPv6
 #options 	INET_CSUM_COUNTERS
 #options 	TCP_CSUM_COUNTERS
 #options 	UDP_CSUM_COUNTERS
+#options 	MVGBE_EVENT_COUNTERS
 
 #options 	NFS_BOOT_BOOTP
 options 	NFS_BOOT_DHCP
@@ -166,7 +168,7 @@ options 	DDB		# in-kernel debugger
 #options 	KGDB
 #options 	DEBUG_KGDB
 makeoptions	DEBUG=-g	# compile full symbol table
-makeoptions	COPTS=-O1
+#makeoptions	COPTS=-O1
 options 	SYMTAB_SPACE=80
 #options 	AUDIO_DEBUG=2
 
@@ -182,18 +184,18 @@ cpu0	at mainbus?
 mvsoc0	at mainbus?
 
 # On-chip PCI Express Interface
-#mvpex*	at mvsoc? offset ? irq ?
+mvpex*	at mvsoc? offset ? irq ?
 
 # PCI bus support
 options 	PCI_NETBSD_CONFIGURE
 #options 	PCI_CONFIG_DUMP		# verbosely dump PCI config space
 
-#pci*	at mvpex?
+pci*	at mvpex?
 
-#pchb*	at pci? dev ? function ?	# PCI-Host bridges
+pchb*	at pci? dev ? function ?	# PCI-Host bridges
 
 # On-chip Serial-ATA II Host Controller (SATAHC)
-#mvsata* at mvsoc? offset ? irq ?
+mvsata* at mvsoc? offset ? irq ?
 
 # On-chip Gigabit Ethernet Controller Interface
 mvgbec* at mvsoc? offset ?
@@ -217,8 +219,8 @@ com*	at mvsoc? offset ? irq ?
 gtidmac* at mvsoc? offset ? irq ?
 
 # On-chip General Purpose I/O Port Interface
-#mvsocgpp* at mvsoc? offset ? irq ?
-#gpio*	at mvsocgpp?
+mvsocgpp* at mvsoc? offset ? irq ?
+gpio*	at mvsocgpp?
 
 # On-chip Timers
 mvsoctmr* at mvsoc? offset ? irq ?
@@ -230,11 +232,11 @@ sdmmc*	at mvsdio?
 ld*	at sdmmc?
 
 # ATA (IDE) bus support
-#atabus* at ata?
+atabus* at ata?
 #options 	ATADEBUG
 
 # IDE drives
-#wd*	at atabus? drive ? flags 0x
+wd*	at atabus? drive ? flags 0x
 
 # ATAPI bus support
 atapibus* at atapi?



CVS commit: src/tests/ipf

2012-12-03 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Dec  3 23:39:30 UTC 2012

Modified Files:
src/tests/ipf: t_pools.sh

Log Message:
Christos fixed the crash in ipftest, so re-enable the failing tests.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/ipf/t_pools.sh

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

Modified files:

Index: src/tests/ipf/t_pools.sh
diff -u src/tests/ipf/t_pools.sh:1.7 src/tests/ipf/t_pools.sh:1.8
--- src/tests/ipf/t_pools.sh:1.7	Sat Dec  1 21:25:51 2012
+++ src/tests/ipf/t_pools.sh	Mon Dec  3 23:39:30 2012
@@ -1,4 +1,4 @@
-# $NetBSD: t_pools.sh,v 1.7 2012/12/01 21:25:51 pgoyette Exp $
+# $NetBSD: t_pools.sh,v 1.8 2012/12/03 23:39:30 pgoyette Exp $
 #
 # Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -73,9 +73,9 @@ test_case p5 ptest text text
 test_case p6 ptest text text
 test_case p7 ptest text text
 test_case p9 ptest text text
-failing_test_case p10 ptest PR kern/47270 - ipftest -P -N is broken text text
-failing_test_case p11 ptest PR kern/47270 - ipftest -P -N is broken text text
-failing_test_case p12 ptest PR kern/47270 - ipftest -P -N is broken text text
+test_case p10 ptest text text
+test_case p11 ptest text text
+test_case p12 ptest text text
 test_case p13 ptest text text
 test_case ip1 iptest text text
 test_case ip2 iptest text text



CVS commit: src/sys/arch/evbarm/conf

2012-12-03 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Dec  3 23:41:35 UTC 2012

Modified Files:
src/sys/arch/evbarm/conf: OPENRD

Log Message:
- Delete no entries for mvsdio sdmmc sbt and ld. The bug was fixed.
- Delete mvpex, pci, pchb, mvsata, atabus and wd. These are defined in
  conf/SHEEVAPLUG


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbarm/conf/OPENRD

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/evbarm/conf/OPENRD
diff -u src/sys/arch/evbarm/conf/OPENRD:1.3 src/sys/arch/evbarm/conf/OPENRD:1.4
--- src/sys/arch/evbarm/conf/OPENRD:1.3	Fri Oct 26 19:15:52 2012
+++ src/sys/arch/evbarm/conf/OPENRD	Mon Dec  3 23:41:35 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: OPENRD,v 1.3 2012/10/26 19:15:52 msaitoh Exp $
+#	$NetBSD: OPENRD,v 1.4 2012/12/03 23:41:35 msaitoh Exp $
 #
 # This is a working config file for OpenRD(.org) Client.  Note that the
 # default boot address will not work and the kernel has to load at 8MB
@@ -20,23 +20,7 @@ makeoptions	LOADADDRESS=0xc080
 options 	COMPAT_NETBSD32
 no options 	COMPAT_LINUX
 
-# this just emits endless errors, disable for now.
-no mvsdio*
-no sdmmc* at mvsdio?
-no sbt* at sdmmc?
-no ld* at sdmmc?
-
-# On-chip PCI Express Interface
-mvpex*	at mvsoc? offset ? irq ?
-
-pci*	at mvpex?
-
-pchb*	at pci? dev ? function ?	# PCI-Host bridges
+# On-board PCI vga
 
 vga*		at pci? dev ? function ?
 wsdisplay*	at vga? console ?
-
-# This has two SATA ports
-mvsata*		at mvsoc? offset ? irq ?
-atabus*		at ata?
-wd*		at atabus? drive ?



CVS commit: src/sys/dev/usb

2012-12-03 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Tue Dec  4 05:50:57 UTC 2012

Modified Files:
src/sys/dev/usb: ugen.c

Log Message:
Fix some error branches in ugen.

There remains some cruft that should perhaps be better organized, but
at least this should reduce some memory leaks in screw cases, and at
least this does fix panics when plugging in and unplugging a USB
device with a botched configuration (a beaglebone with a hosed sd
card).


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/sys/dev/usb/ugen.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/dev/usb/ugen.c
diff -u src/sys/dev/usb/ugen.c:1.120 src/sys/dev/usb/ugen.c:1.121
--- src/sys/dev/usb/ugen.c:1.120	Sun Jun 10 06:15:53 2012
+++ src/sys/dev/usb/ugen.c	Tue Dec  4 05:50:57 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ugen.c,v 1.120 2012/06/10 06:15:53 mrg Exp $	*/
+/*	$NetBSD: ugen.c,v 1.121 2012/12/04 05:50:57 riastradh Exp $	*/
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ugen.c,v 1.120 2012/06/10 06:15:53 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ugen.c,v 1.121 2012/12/04 05:50:57 riastradh Exp $);
 
 #include opt_compat_netbsd.h
 
@@ -91,7 +91,6 @@ struct ugen_endpoint {
 #define UGEN_RA_WB_STOP	0x20	/* RA/WB xfer is stopped (buffer full/empty) */
 	usbd_pipe_handle pipeh;
 	struct clist q;
-	struct selinfo rsel;
 	u_char *ibuf;		/* start of buffer (circular for isoc) */
 	u_char *fill;		/* location for input (isoc) */
 	u_char *limit;		/* end of circular buffer (isoc) */
@@ -108,8 +107,10 @@ struct ugen_endpoint {
 		void *dmabuf;
 		u_int16_t sizes[UGEN_NISORFRMS];
 	} isoreqs[UGEN_NISOREQS];
-	/* Keep this last; we don't overwrite it in ugen_set_config() */
-	kcondvar_t		cv;
+	/* Keep these last; we don't overwrite them in ugen_set_config() */
+#define UGEN_ENDPOINT_NONZERO_CRUFT	offsetof(struct ugen_endpoint, rsel)
+	struct selinfo rsel;
+	kcondvar_t cv;
 };
 
 struct ugen_softc {
@@ -216,6 +217,16 @@ ugen_attach(device_t parent, device_t se
 	sc-sc_dev = self;
 	sc-sc_udev = udev = uaa-device;
 
+	for (i = 0; i  USB_MAX_ENDPOINTS; i++) {
+		for (dir = OUT; dir = IN; dir++) {
+			struct ugen_endpoint *sce;
+
+			sce = sc-sc_endpoints[i][dir];
+			selinit(sce-rsel);
+			cv_init(sce-cv, ugensce);
+		}
+	}
+
 	/* First set configuration index 0, the default one for ugen. */
 	err = usbd_set_config_index(udev, 0, 0);
 	if (err) {
@@ -235,16 +246,6 @@ ugen_attach(device_t parent, device_t se
 		return;
 	}
 
-	for (i = 0; i  USB_MAX_ENDPOINTS; i++) {
-		for (dir = OUT; dir = IN; dir++) {
-			struct ugen_endpoint *sce;
-
-			sce = sc-sc_endpoints[i][dir];
-			selinit(sce-rsel);
-			cv_init(sce-cv, ugensce);
-		}
-	}
-
 	usbd_add_drv_event(USB_EVENT_DRIVER_ATTACH, sc-sc_udev,
 			   sc-sc_dev);
 
@@ -294,11 +295,11 @@ ugen_set_config(struct ugen_softc *sc, i
 	if (err)
 		return (err);
 
-	/* Clear out the old info, but leave the cv initialised. */
+	/* Clear out the old info, but leave the selinfo and cv initialised. */
 	for (i = 0; i  USB_MAX_ENDPOINTS; i++) {
 		for (dir = OUT; dir = IN; dir++) {
 			sce = sc-sc_endpoints[i][dir];
-			memset(sce, 0, offsetof(struct ugen_endpoint, cv));
+			memset(sce, 0, UGEN_ENDPOINT_NONZERO_CRUFT);
 		}
 	}
 
@@ -396,16 +397,20 @@ ugenopen(dev_t dev, int flag, int mode, 
 			sce-ibuf = malloc(isize, M_USBDEV, M_WAITOK);
 			DPRINTFN(5, (ugenopen: intr endpt=%d,isize=%d\n,
  endpt, isize));
-			if (clalloc(sce-q, UGEN_IBSIZE, 0) == -1)
+			if (clalloc(sce-q, UGEN_IBSIZE, 0) == -1) {
+free(sce-ibuf, M_USBDEV);
+sce-ibuf = NULL;
 return (ENOMEM);
+			}
 			err = usbd_open_pipe_intr(sce-iface,
   edesc-bEndpointAddress,
   USBD_SHORT_XFER_OK, sce-pipeh, sce,
   sce-ibuf, isize, ugenintr,
   USBD_DEFAULT_INTERVAL);
 			if (err) {
-free(sce-ibuf, M_USBDEV);
 clfree(sce-q);
+free(sce-ibuf, M_USBDEV);
+sce-ibuf = NULL;
 return (EIO);
 			}
 			DPRINTFN(5, (ugenopen: interrupt open done\n));
@@ -416,7 +421,7 @@ ugenopen(dev_t dev, int flag, int mode, 
 			if (err)
 return (EIO);
 			sce-ra_wb_bufsize = UGEN_BULK_RA_WB_BUFSIZE;
-			/* 
+			/*
 			 * Use request size for non-RA/WB transfers
 			 * as the default.
 			 */
@@ -438,6 +443,7 @@ ugenopen(dev_t dev, int flag, int mode, 
   edesc-bEndpointAddress, 0, sce-pipeh);
 			if (err) {
 free(sce-ibuf, M_USBDEV);
+sce-ibuf = NULL;
 return (EIO);
 			}
 			for(i = 0; i  UGEN_NISOREQS; ++i) {
@@ -467,6 +473,10 @@ ugenopen(dev_t dev, int flag, int mode, 
 		bad:
 			while (--i = 0) /* implicit buffer free */
 usbd_free_xfer(sce-isoreqs[i].xfer);
+			usbd_close_pipe(sce-pipeh);
+			sce-pipeh = NULL;
+			free(sce-ibuf, M_USBDEV);
+			sce-ibuf = NULL;
 			return (ENOMEM);
 		case UE_CONTROL:
 			sce-timeout = USBD_DEFAULT_TIMEOUT;



CVS commit: src

2012-12-03 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Tue Dec  4 06:57:45 UTC 2012

Modified Files:
src/distrib/sets/lists/tests: mi
src/share/man/man3: bitmap.3 bitops.3 bitstring.3
src/tests/include/sys: t_bitops.c
src/tests/lib/libc/sys: Makefile
Removed Files:
src/tests/lib/libc/sys: t_bitops.c

Log Message:
Move the bitmap(3) test to the right place. Note it in bitops(3). Xrefs.


To generate a diff of this commit:
cvs rdiff -u -r1.511 -r1.512 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.3 -r1.4 src/share/man/man3/bitmap.3 \
src/share/man/man3/bitops.3
cvs rdiff -u -r1.13 -r1.14 src/share/man/man3/bitstring.3
cvs rdiff -u -r1.14 -r1.15 src/tests/include/sys/t_bitops.c
cvs rdiff -u -r1.29 -r1.30 src/tests/lib/libc/sys/Makefile
cvs rdiff -u -r1.1 -r0 src/tests/lib/libc/sys/t_bitops.c

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.511 src/distrib/sets/lists/tests/mi:1.512
--- src/distrib/sets/lists/tests/mi:1.511	Sat Dec  1 16:30:00 2012
+++ src/distrib/sets/lists/tests/mi	Tue Dec  4 06:57:44 2012
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.511 2012/12/01 16:30:00 christos Exp $
+# $NetBSD: mi,v 1.512 2012/12/04 06:57:44 jruoho Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -548,7 +548,7 @@
 ./usr/libdata/debug/usr/tests/lib/libc/string/t_swab.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/systests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_access.debug		tests-lib-debug		debug,atf
-./usr/libdata/debug/usr/tests/lib/libc/sys/t_bitops.debug		tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libc/sys/t_bitops.debug		tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_cerror.debug		tests-obsolete		obsolete
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_chroot.debug		tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libc/sys/t_clock_gettime.debug	tests-lib-debug		debug,atf
@@ -2491,7 +2491,7 @@
 ./usr/tests/lib/libc/sys			tests-lib-tests
 ./usr/tests/lib/libc/sys/Atffile		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_access		tests-lib-tests		atf
-./usr/tests/lib/libc/sys/t_bitops		tests-lib-tests		atf
+./usr/tests/lib/libc/sys/t_bitops		tests-obsolete		obsolete
 ./usr/tests/lib/libc/sys/t_cerror		tests-obsolete		obsolete
 ./usr/tests/lib/libc/sys/t_chroot		tests-lib-tests		atf
 ./usr/tests/lib/libc/sys/t_clock_gettime	tests-lib-tests		atf

Index: src/share/man/man3/bitmap.3
diff -u src/share/man/man3/bitmap.3:1.3 src/share/man/man3/bitmap.3:1.4
--- src/share/man/man3/bitmap.3:1.3	Sat Dec  1 21:21:44 2012
+++ src/share/man/man3/bitmap.3	Tue Dec  4 06:57:45 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: bitmap.3,v 1.3 2012/12/01 21:21:44 wiz Exp $
+.\	$NetBSD: bitmap.3,v 1.4 2012/12/04 06:57:45 jruoho Exp $
 .\
 .\ Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -27,7 +27,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd December 1, 2012
+.Dd December 4, 2012
 .Dt BITMAP 3
 .Os
 .Sh NAME
@@ -125,6 +125,7 @@ main(int argc, char **argv)
 .Ed
 .Sh SEE ALSO
 .Xr select 2 ,
+.Xr bitops 3 ,
 .Xr bitstring 3
 .Sh HISTORY
 The
Index: src/share/man/man3/bitops.3
diff -u src/share/man/man3/bitops.3:1.3 src/share/man/man3/bitops.3:1.4
--- src/share/man/man3/bitops.3:1.3	Fri Apr  8 08:46:12 2011
+++ src/share/man/man3/bitops.3	Tue Dec  4 06:57:45 2012
@@ -1,4 +1,4 @@
-.\ $NetBSD: bitops.3,v 1.3 2011/04/08 08:46:12 jruoho Exp $
+.\ $NetBSD: bitops.3,v 1.4 2012/12/04 06:57:45 jruoho Exp $
 .\
 .\ Copyright (c) 2011 Jukka Ruohonen jruoho...@iki.fi
 .\ All rights reserved.
@@ -24,7 +24,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 8, 2011
+.Dd December 4, 2012
 .Dt BITOPS 3
 .Os
 .Sh NAME
@@ -35,11 +35,13 @@
 .Sh DESCRIPTION
 The
 .In sys/bitops.h
-header includes some
+header includes macros and
 .Em static inline
 functions related bits and integers.
 Among these are:
 .Bl -tag -width fast_divide32(3)  -offset indent
+.It Xr bitmap 3
+bitmap manipulation macros
 .It Xr ffs32 3
 functions to find the first and last bit in integers of type
 .Vt uint32_t

Index: src/share/man/man3/bitstring.3
diff -u src/share/man/man3/bitstring.3:1.13 src/share/man/man3/bitstring.3:1.14
--- src/share/man/man3/bitstring.3:1.13	Tue Mar  8 10:53:34 2005
+++ src/share/man/man3/bitstring.3	Tue Dec  4 06:57:45 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: bitstring.3,v 1.13 2005/03/08 10:53:34 wiz Exp $
+.\	$NetBSD: bitstring.3,v 1.14 2012/12/04 06:57:45 jruoho Exp $
 .\
 .\ Copyright (c) 1989, 1991, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -31,7 +31,7 @@
 .\
 .\ @(#)bitstring.3	8.1 (Berkeley) 7/19/93
 .\
-.Dd July 

CVS commit: [matt-nb6-plus] src/sys/conf

2012-12-03 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Dec  4 07:00:31 UTC 2012

Modified Files:
src/sys/conf [matt-nb6-plus]: Makefile.kern.inc

Log Message:
Add SYSTEM_LD_TAIL_DBSYM for arm.


To generate a diff of this commit:
cvs rdiff -u -r1.152 -r1.152.4.1 src/sys/conf/Makefile.kern.inc

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

Modified files:

Index: src/sys/conf/Makefile.kern.inc
diff -u src/sys/conf/Makefile.kern.inc:1.152 src/sys/conf/Makefile.kern.inc:1.152.4.1
--- src/sys/conf/Makefile.kern.inc:1.152	Sun Feb 12 16:34:11 2012
+++ src/sys/conf/Makefile.kern.inc	Tue Dec  4 07:00:30 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.kern.inc,v 1.152 2012/02/12 16:34:11 matt Exp $
+#	$NetBSD: Makefile.kern.inc,v 1.152.4.1 2012/12/04 07:00:30 matt Exp $
 #
 # This file contains common `MI' targets and definitions and it is included
 # at the bottom of each `MD' ${MACHINE}/conf/Makefile.${MACHINE}.
@@ -236,6 +236,7 @@ SYSTEM_LD?=	@${_MKSHMSG}link  ${.CU
 SYSTEM_LD_TAIL?=@${TOOL_SED} '/const char sccs/!d;s/.*@(.)//;s/\\.*//' vers.c; \
 		${SIZE} $@; chmod 755 $@; \
 		${SYSTEM_CTFMERGE}
+SYSTEM_LD_TAIL_DBSYM?=  true
 
 TEXTADDR?=	${LOADADDRESS}			# backwards compatibility
 LINKTEXT?=	${TEXTADDR:C/.+/-Ttext /}



CVS commit: othersrc/external/bsd/rs/dist

2012-12-03 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Dec  4 07:24:19 UTC 2012

Modified Files:
othersrc/external/bsd/rs/dist: rs.c

Log Message:
feedback from fuzz testing - check arguments to functions on input.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/rs/dist/rs.c

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

Modified files:

Index: othersrc/external/bsd/rs/dist/rs.c
diff -u othersrc/external/bsd/rs/dist/rs.c:1.3 othersrc/external/bsd/rs/dist/rs.c:1.4
--- othersrc/external/bsd/rs/dist/rs.c:1.3	Tue Apr 26 15:41:26 2011
+++ othersrc/external/bsd/rs/dist/rs.c	Tue Dec  4 07:24:19 2012
@@ -513,6 +513,9 @@ le32(uint32_t in)
 int
 rs_init(rs_t *rs, const unsigned poly, const uint8_t databytes, const uint8_t paritybytes)
 {
+	if (rs == NULL) {
+		return 0;
+	}
 	if (paritybytes  databytes) {
 		(void) fprintf(stderr, paritybytes %u larger than data bytes %u\n,
 			paritybytes, databytes);
@@ -544,6 +547,9 @@ rs_encode(rs_t *rs, const void *inp, siz
 	size_t		 incc;
 	size_t		 chunk;
 
+	if (rs == NULL || inp == NULL || out == NULL) {
+		return -1;
+	}
 	if (!rs-header.poly) {
 		rs_init(rs, RS_DEFAULT_POLYNOMIAL, RS_DEFAULT_DATA, RS_DEFAULT_PARITY);
 	}
@@ -564,6 +570,9 @@ rs_decode(rs_t *rs, const void *inp, siz
 	size_t		 incc;
 	size_t		 chunk;
 
+	if (rs == NULL || inp == NULL || out == NULL) {
+		return -1;
+	}
 	for (outcc = 0, incc = 0 ; incc  size  outcc  (ssize_t)outsize ; incc += chunk) {
 		chunk = MIN(size - incc, rs-header.datac + rs-header.parityc);
 		if ((cc = decode_chunk(rs, in[incc], chunk, out[outcc]))  0) {
@@ -580,6 +589,9 @@ rs_get_header(rs_t *rs, const void *in, 
 {
 	rs_header_t	head;
 
+	if (rs == NULL || in == NULL) {
+		return -1;
+	}
 	USE_ARG(insize);
 	(void) memcpy(head, in, sizeof(head));
 	head.poly = le32(head.poly);
@@ -593,6 +605,9 @@ rs_put_header(rs_t *rs, void *out, size_
 {
 	rs_header_t	head;
 
+	if (rs == NULL || out == NULL) {
+		return -1;
+	}
 	USE_ARG(outsize);
 	(void) memcpy(head, rs-header, sizeof(head));
 	(void) snprintf(head.magic, sizeof(head.magic), %s, RS_MAGIC);
@@ -611,6 +626,9 @@ rs_parity(rs_t *rs, const void *inp, siz
 	size_t		 incc;
 	size_t		 chunk;
 
+	if (rs == NULL || inp == NULL || out == NULL) {
+		return -1;
+	}
 	if (!rs-header.poly) {
 		rs_init(rs, RS_DEFAULT_POLYNOMIAL, RS_DEFAULT_DATA, RS_DEFAULT_PARITY);
 	}



CVS commit: othersrc/external/bsd/threshold/dist/src/libthreshold

2012-12-03 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Dec  4 07:39:19 UTC 2012

Modified Files:
othersrc/external/bsd/threshold/dist/src/libthreshold: ida.c raid.c
threshold.c

Log Message:
feedback from fuzz testing - check arguments on entry to functions


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
othersrc/external/bsd/threshold/dist/src/libthreshold/ida.c \
othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c \
othersrc/external/bsd/threshold/dist/src/libthreshold/threshold.c

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

Modified files:

Index: othersrc/external/bsd/threshold/dist/src/libthreshold/ida.c
diff -u othersrc/external/bsd/threshold/dist/src/libthreshold/ida.c:1.1.1.1 othersrc/external/bsd/threshold/dist/src/libthreshold/ida.c:1.2
--- othersrc/external/bsd/threshold/dist/src/libthreshold/ida.c:1.1.1.1	Sat Mar 12 08:13:08 2011
+++ othersrc/external/bsd/threshold/dist/src/libthreshold/ida.c	Tue Dec  4 07:39:19 2012
@@ -194,6 +194,9 @@ ida_split(threshold_t *thresh)
 	size_t		 insize;
 	ida_t		*ida;
 
+	if (thresh == NULL) {
+		return 0;
+	}
 	ida = (ida_t *)thresh-handle;
 	mem = thresh-shares[THRESH_MAX_SHARES];
 	thresh_fmt_header(head, IDA_MAGIC, thresh-threshold, thresh-sharesc, mem-io.size);
@@ -240,6 +243,9 @@ ida_combine(threshold_t *thresh)
 	ida_t		*ida;
 	int		 cc;
 
+	if (thresh == NULL) {
+		return 0;
+	}
 	ida = (ida_t *)thresh-handle;
 	(void) memset(coeff, 0x0, sizeof(coeff));
 	for (i = 0 ; i  thresh-availc ; i++) {
@@ -274,7 +280,7 @@ ida_combine(threshold_t *thresh)
 arr[i] = gfadd(arr[i], gfmuls[ida-matrix[SUBSCRIPT(i, j, thresh-threshold)]][ch]);
 			}
 		}
-		cc = MIN(thresh-threshold, (heads[0].size - out-c));
+		cc = MIN((int)thresh-threshold, (int)(heads[0].size - out-c));
 		(void) memcpy(out-io.base[out-c], arr, cc);
 		out-c += cc;
 	}
@@ -293,6 +299,9 @@ ida_init(threshold_t *threshold, unsigne
 	unsigned	j;
 	ida_t		*ida;
 
+	if (threshold == NULL) {
+		return 0;
+	}
 	if ((ida = calloc(1, sizeof(ida_t))) == NULL) {
 		(void) fprintf(stderr, can't allocate ida\n);
 		return 0;
@@ -320,6 +329,9 @@ ida_end(threshold_t *threshold)
 {
 	ida_t	*ida;
 
+	if (threshold == NULL) {
+		return 0;
+	}
 	if ((ida = threshold-handle) != NULL) {
 		if (ida-matrix) {
 			free(ida-matrix);
Index: othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c
diff -u othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c:1.1.1.1 othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c:1.2
--- othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c:1.1.1.1	Sat Mar 12 08:13:08 2011
+++ othersrc/external/bsd/threshold/dist/src/libthreshold/raid.c	Tue Dec  4 07:39:19 2012
@@ -154,6 +154,9 @@ raid_init(threshold_t *thresh, unsigned 
 {
 	raid_t	*raid;
 
+	if (thresh == NULL) {
+		return 0;
+	}
 	if ((raid = calloc(1, sizeof(*raid))) == NULL) {
 		fprintf(stderr, raid_init: unable to allocate space\n);
 		return 0;
@@ -179,6 +182,9 @@ raid_split_memory(threshold_t *thresh, c
 	uint8_t		*parity;
 	raid_t		*raid;
 
+	if (thresh == NULL || input == NULL) {
+		return 0;
+	}
 	in = (const uint8_t *)input;
 	raid = thresh-handle;
 	blocksize = threshold;	/* overloaded here */
@@ -223,8 +229,11 @@ raid_split(threshold_t *thresh)
 {
 	thresh_str_t	*mem;
 
+	if (thresh == NULL) {
+		return 0;
+	}
 	mem = thresh-shares[THRESH_MAX_SHARES];
-	return raid_split_memory(thresh, mem-io.base, mem-io.size, thresh-threshold, thresh-sharesc);
+	return raid_split_memory(thresh, mem-io.base, (unsigned)mem-io.size, thresh-threshold, thresh-sharesc);
 }
 
 /* split the file into shares */
@@ -237,6 +246,9 @@ raid_split_file(threshold_t *thresh, con
 	FILE		*fp;
 	int		 ret;
 
+	if (thresh == NULL || f == NULL) {
+		return 0;
+	}
 	if (!check_values(blocksize, disks)) {
 		return 0;
 	}
@@ -252,7 +264,7 @@ raid_split_file(threshold_t *thresh, con
 		return 0;
 	}
 	/* Do the work */
-	ret = raid_split_memory(thresh, mem, bytes, blocksize, disks);
+	ret = raid_split_memory(thresh, mem, (unsigned)bytes, blocksize, disks);
 	(void) fclose(fp);
 	(void) munmap(mem, bytes);
 	return ret;
@@ -271,6 +283,9 @@ raid_join_file(threshold_t *thresh, char
 	int		 good;
 	int		 ret;
 
+	if (thresh == NULL || files == NULL || str == NULL) {
+		return 0;
+	}
 	raid = thresh-handle;
 	if (raid-blocksize == 0) {
 		raid-blocksize = DEFAULT_BLOCKSIZE;
@@ -337,6 +352,9 @@ raid_join_memory(threshold_t *thresh, th
 	raid_t		*raid;
 	int		 repair;
 
+	if (thresh == NULL || inputv == NULL) {
+		return 0;
+	}
 	raid = thresh-handle;
 	if (raid-blocksize == 0) {
 		raid-blocksize = DEFAULT_BLOCKSIZE;
@@ -362,7 +380,7 @@ raid_join_memory(threshold_t *thresh, th
 int
 raid_end(threshold_t *thresh)
 {
-	if (thresh-handle) {
+	if (thresh  thresh-handle) {
 		free(thresh-handle);
 	}
 	return 1;
@@ -375,6 +393,9 @@ raid_end(threshold_t *thresh)
 int
 raid_read_header(const char *mem, 

CVS commit: othersrc/external/bsd/vmdk/dist

2012-12-03 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Tue Dec  4 07:45:36 UTC 2012

Modified Files:
othersrc/external/bsd/vmdk/dist: libvmdk.c

Log Message:
feedback from fuzz testing - check function arguments on input


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 othersrc/external/bsd/vmdk/dist/libvmdk.c

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

Modified files:

Index: othersrc/external/bsd/vmdk/dist/libvmdk.c
diff -u othersrc/external/bsd/vmdk/dist/libvmdk.c:1.1.1.1 othersrc/external/bsd/vmdk/dist/libvmdk.c:1.2
--- othersrc/external/bsd/vmdk/dist/libvmdk.c:1.1.1.1	Sat Jan  7 03:11:15 2012
+++ othersrc/external/bsd/vmdk/dist/libvmdk.c	Tue Dec  4 07:45:36 2012
@@ -224,6 +224,9 @@ vmdk_make_vmdk(const char *vmname, int s
 	FILE	*vmdk;
 	int	 ret;
 
+	if (vmname == NULL) {
+		return 0;
+	}
 	(void) snprintf(vmdkname, sizeof(vmdkname), %s.vmdk, vmname);
 	if ((vmdk = fopen(vmdkname, w)) == NULL) {
 		warn(can't open vmdk file '%s', vmdkname);
@@ -247,6 +250,9 @@ vmdk_file_to_vmdk(const char *vmname, co
 	FILE		*img;
 	int		 ret;
 
+	if (vmname == NULL || imgname == NULL) {
+		return 0;
+	}
 	(void) snprintf(vmdkname, sizeof(vmdkname), %s.vmdk, vmname);
 	if ((vmdk = fopen(vmdkname, w)) == NULL) {
 		warn(can't open vmdk file '%s', vmdkname);
@@ -280,6 +286,9 @@ vmdk_make_extent(const char *img, uint64
 	FILE		*fp;
 	int		 ret;
 
+	if (img == NULL) {
+		return 0;
+	}
 	if ((fp = fopen(img, w)) == NULL) {
 		warn(can't write to image '%s', img);
 		return 0;
@@ -301,6 +310,9 @@ vmdk_list_extent(const char *img)
 	FILE			*fp;
 	int			 ret;
 
+	if (img == NULL) {
+		return 0;
+	}
 	(void) memset(header, 0x0, sizeof(header));
 	if ((fp = fopen(img, r)) == NULL) {
 		warn(can't read from image '%s', img);