CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 06:47:15 UTC 2014

Modified Files:
src/usr.sbin/sysinst: net.c

Log Message:
Remove duplicate fclose(), pointed out by coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/net.c

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

Modified files:

Index: src/usr.sbin/sysinst/net.c
diff -u src/usr.sbin/sysinst/net.c:1.2 src/usr.sbin/sysinst/net.c:1.3
--- src/usr.sbin/sysinst/net.c:1.2	Sun Aug  3 16:09:38 2014
+++ src/usr.sbin/sysinst/net.c	Tue Aug 19 06:47:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.2 2014/08/03 16:09:38 martin Exp $	*/
+/*	$NetBSD: net.c,v 1.3 2014/08/19 06:47:15 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1176,8 +1176,6 @@ mnt_net_config(void)
 			write_etc_hosts(hosts);
 			(void)fclose(hosts);
 			scripting_fprintf(NULL, EOF\n);
-
-			fclose(hosts);
 		}
 
 		if (del_rc_conf(defaultroute) == 0)



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 06:49:21 UTC 2014

Modified Files:
src/usr.sbin/sysinst: mbr.c

Log Message:
Remove (accidently) duplicated code - pointed out by coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/sysinst/mbr.c

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

Modified files:

Index: src/usr.sbin/sysinst/mbr.c
diff -u src/usr.sbin/sysinst/mbr.c:1.2 src/usr.sbin/sysinst/mbr.c:1.3
--- src/usr.sbin/sysinst/mbr.c:1.2	Sun Aug  3 16:09:38 2014
+++ src/usr.sbin/sysinst/mbr.c	Tue Aug 19 06:49:21 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: mbr.c,v 1.2 2014/08/03 16:09:38 martin Exp $ */
+/*	$NetBSD: mbr.c,v 1.3 2014/08/19 06:49:21 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1148,8 +1148,7 @@ set_mbr_label(menudesc *m, int opt, void
 #ifdef BOOTSEL
 	if (mbri-mbrb.mbrbs_nametab[opt][0] != 0) {
 		int x, y;
-		if (opt = MBR_PART_COUNT)
-			opt = 0;
+
 		getyx(m-mw, y, x);
 		if (x  52) {
 			x = 52;



CVS commit: src/sys/sys

2014-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug 19 07:26:46 UTC 2014

Modified Files:
src/sys/sys: exec_elf.h

Log Message:
EM_OPENRISC is now EM_OR1K but keep a define of EM_OPENRISC to EM_OR1K around.


To generate a diff of this commit:
cvs rdiff -u -r1.141 -r1.142 src/sys/sys/exec_elf.h

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

Modified files:

Index: src/sys/sys/exec_elf.h
diff -u src/sys/sys/exec_elf.h:1.141 src/sys/sys/exec_elf.h:1.142
--- src/sys/sys/exec_elf.h:1.141	Tue Jul  8 17:16:25 2014
+++ src/sys/sys/exec_elf.h	Tue Aug 19 07:26:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: exec_elf.h,v 1.141 2014/07/08 17:16:25 maxv Exp $	*/
+/*	$NetBSD: exec_elf.h,v 1.142 2014/08/19 07:26:45 matt Exp $	*/
 
 /*-
  * Copyright (c) 1994 The NetBSD Foundation, Inc.
@@ -280,7 +280,8 @@ typedef struct {
 #define EM_MN10300	89	/* Matsushita MN10300 */
 #define EM_MN10200	90	/* Matsushita MN10200 */
 #define EM_PJ		91	/* picoJava */
-#define EM_OPENRISC	92	/* OpenRISC 32-bit embedded processor */
+#define EM_OR1K		92	/* OpenRISC 32-bit embedded processor */
+#define EM_OPENRISC	EM_OR1K
 #define EM_ARC_A5	93	/* ARC Cores Tangent-A5 */
 #define EM_XTENSA	94	/* Tensilica Xtensa Architecture */
 #define EM_VIDEOCORE	95	/* Alphamosaic VideoCore processor */



CVS commit: src/sys/sys

2014-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug 19 07:27:31 UTC 2014

Modified Files:
src/sys/sys: Makefile
Added Files:
src/sys/sys: common_ansi.h common_limits.h

Log Message:
More common includes which use the preprocessor defined macros.


To generate a diff of this commit:
cvs rdiff -u -r1.150 -r1.151 src/sys/sys/Makefile
cvs rdiff -u -r0 -r1.1 src/sys/sys/common_ansi.h src/sys/sys/common_limits.h

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

Modified files:

Index: src/sys/sys/Makefile
diff -u src/sys/sys/Makefile:1.150 src/sys/sys/Makefile:1.151
--- src/sys/sys/Makefile:1.150	Mon Aug 18 22:33:25 2014
+++ src/sys/sys/Makefile	Tue Aug 19 07:27:31 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.150 2014/08/18 22:33:25 matt Exp $
+#	$NetBSD: Makefile,v 1.151 2014/08/19 07:27:31 matt Exp $
 
 .include bsd.own.mk
 
@@ -8,8 +8,9 @@ INCS=	acct.h agpio.h aio.h ansi.h aout_m
 	bitops.h bootblock.h bswap.h buf.h \
 	callback.h callout.h cdbr.h cdefs.h cdefs_aout.h \
 	cdefs_elf.h cdio.h chio.h clockctl.h \
-	common_int_const.h common_int_fmtio.h common_int_limits.h \
-	common_int_mwgwtypes.h common_int_types.h common_wchar_limits.h \
+	common_ansi.h common_int_const.h common_int_fmtio.h \
+	common_int_limits.h common_int_mwgwtypes.h common_int_types.h \
+	common_limits.h common_wchar_limits.h \
 	condvar.h conf.h core.h \
 	cpufreq.h cpuio.h ctype_bits.h ctype_inline.h \
 	device.h device_if.h \

Added files:

Index: src/sys/sys/common_ansi.h
diff -u /dev/null src/sys/sys/common_ansi.h:1.1
--- /dev/null	Tue Aug 19 07:27:31 2014
+++ src/sys/sys/common_ansi.h	Tue Aug 19 07:27:31 2014
@@ -0,0 +1,76 @@
+/*	$NetBSD: common_ansi.h,v 1.1 2014/08/19 07:27:31 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef _SYS_COMMON_ANSI_H_
+#define _SYS_COMMON_ANSI_H_
+
+#include sys/cdefs.h
+
+#include machine/int_types.h
+
+#if !defined(__PTRDIFF_TYPE__)
+#error __PTRDIFF_TYPE__ not present
+#endif
+
+#if !defined(__SIZE_TYPE__)
+#error __SIZE_TYPE__ not present
+#endif
+
+#if !defined(__WCHAR_TYPE__)
+#error __WCHAR_TYPE__ not present
+#endif
+
+#if !defined(__WINT_TYPE__)
+#error __WINT_TYPE__ not present
+#endif
+
+/*
+ * Types which are fundamental to the implementation and may appear in
+ * more than one standard header are defined here.  Standard headers
+ * then use:
+ *	#ifdef	_BSD_SIZE_T_
+ *	typedef	_BSD_SIZE_T_ size_t;
+ *	#undef	_BSD_SIZE_T_
+ *	#endif
+ */
+#define	_BSD_CLOCK_T_		unsigned int	/* clock() */
+#define	_BSD_PTRDIFF_T_		__PTRDIFF_TYPE__ /* ptr1 - ptr2 */
+#define	_BSD_SSIZE_T_		__PTRDIFF_TYPE__ /* byte count or error */
+#define	_BSD_SIZE_T_		__SIZE_TYPE__	/* sizeof() */
+#define	_BSD_TIME_T_		__int64_t	/* time() */
+#define	_BSD_CLOCKID_T_		int		/* clockid_t */
+#define	_BSD_TIMER_T_		int		/* timer_t */
+#define	_BSD_SUSECONDS_T_	int		/* suseconds_t */
+#define	_BSD_USECONDS_T_	unsigned int	/* useconds_t */
+#define	_BSD_WCHAR_T_		__WCHAR_TYPE__	/* wchar_t */
+#define	_BSD_WINT_T_		__WINT_TYPE__	/* wint_t */
+
+#endif	/* _SYS_COMMON_ANSI_H_ */
Index: src/sys/sys/common_limits.h
diff -u /dev/null src/sys/sys/common_limits.h:1.1
--- /dev/null	Tue Aug 19 07:27:31 2014
+++ src/sys/sys/common_limits.h	Tue Aug 19 07:27:31 2014
@@ -0,0 +1,109 @@
+/*	$NetBSD: common_limits.h,v 1.1 2014/08/19 07:27:31 matt Exp $	*/
+
+/*-
+ * Copyright (c) 2014 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived 

CVS commit: src/distrib/sets/lists/comp

2014-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug 19 07:28:45 UTC 2014

Modified Files:
src/distrib/sets/lists/comp: mi

Log Message:
Add ./usr/include/sys/common_{ansi,limits}.h


To generate a diff of this commit:
cvs rdiff -u -r1.1907 -r1.1908 src/distrib/sets/lists/comp/mi

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/comp/mi
diff -u src/distrib/sets/lists/comp/mi:1.1907 src/distrib/sets/lists/comp/mi:1.1908
--- src/distrib/sets/lists/comp/mi:1.1907	Mon Aug 18 22:33:25 2014
+++ src/distrib/sets/lists/comp/mi	Tue Aug 19 07:28:45 2014
@@ -1,4 +1,4 @@
-#	$NetBSD: mi,v 1.1907 2014/08/18 22:33:25 matt Exp $
+#	$NetBSD: mi,v 1.1908 2014/08/19 07:28:45 matt Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -3132,11 +3132,13 @@
 ./usr/include/sys/chio.h			comp-c-include
 ./usr/include/sys/clist.h			comp-obsolete		obsolete
 ./usr/include/sys/clockctl.h			comp-c-include
+./usr/include/sys/common_ansi.h			comp-c-include
 ./usr/include/sys/common_int_const.h		comp-c-include
 ./usr/include/sys/common_int_fmtio.h		comp-c-include
 ./usr/include/sys/common_int_limits.h		comp-c-include
 ./usr/include/sys/common_int_mwgwtypes.h	comp-c-include
 ./usr/include/sys/common_int_types.h		comp-c-include
+./usr/include/sys/common_limits.h		comp-c-include
 ./usr/include/sys/common_wchar_limits.h		comp-c-include
 ./usr/include/sys/condvar.h			comp-c-include
 ./usr/include/sys/conf.h			comp-c-include



CVS commit: src/bin/sh

2014-08-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 19 12:36:58 UTC 2014

Modified Files:
src/bin/sh: parser.c

Log Message:
PR/49125: Havard Eidnes: /bin/sh does not support redirecting to or from FDs  9
According to:
http://pubs.opengroup.org/onlinepubs/009604599/utilities/xcu_chap02.html#tag_02_07

Redirection support for fds  9 is optional but allowed.


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/bin/sh/parser.c

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

Modified files:

Index: src/bin/sh/parser.c
diff -u src/bin/sh/parser.c:1.90 src/bin/sh/parser.c:1.91
--- src/bin/sh/parser.c:1.90	Wed Jan  1 14:50:44 2014
+++ src/bin/sh/parser.c	Tue Aug 19 08:36:58 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: parser.c,v 1.90 2014/01/01 19:50:44 christos Exp $	*/
+/*	$NetBSD: parser.c,v 1.91 2014/08/19 12:36:58 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)parser.c	8.7 (Berkeley) 5/16/95;
 #else
-__RCSID($NetBSD: parser.c,v 1.90 2014/01/01 19:50:44 christos Exp $);
+__RCSID($NetBSD: parser.c,v 1.91 2014/08/19 12:36:58 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -647,8 +647,8 @@ void fixredir(union node *n, const char 
 	if (!err)
 		n-ndup.vname = NULL;
 
-	if (is_digit(text[0])  text[1] == '\0')
-		n-ndup.dupfd = digit_val(text[0]);
+	if (is_number(text))
+		n-ndup.dupfd = number(text);
 	else if (text[0] == '-'  text[1] == '\0')
 		n-ndup.dupfd = -1;
 	else {
@@ -1149,8 +1149,7 @@ endword:
 	if (eofmark == NULL) {
 		if ((c == '' || c == '')
 		  quotef == 0
-		  len = 2
-		  (*out == '\0' || is_digit(*out))) {
+		  (*out == '\0' || is_number(out))) {
 			PARSEREDIR();
 			return lasttoken = TREDIR;
 		} else {
@@ -1208,8 +1207,9 @@ checkend: {
  */
 
 parseredir: {
-	char fd = *out;
+	char fd[64];
 	union node *np;
+	strlcpy(fd, out, sizeof(fd));
 
 	np = (union node *)stalloc(sizeof (struct nfile));
 	if (c == '') {
@@ -1258,8 +1258,8 @@ parseredir: {
 			break;
 		}
 	}
-	if (fd != '\0')
-		np-nfile.fd = digit_val(fd);
+	if (*fd != '\0')
+		np-nfile.fd = number(fd);
 	redirnode = np;
 	goto parseredir_return;
 }



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:01:48 UTC 2014

Modified Files:
src/usr.sbin/sysinst: net.c

Log Message:
Make sure the interface name is 0 terminated, pointed out by coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/net.c

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

Modified files:

Index: src/usr.sbin/sysinst/net.c
diff -u src/usr.sbin/sysinst/net.c:1.3 src/usr.sbin/sysinst/net.c:1.4
--- src/usr.sbin/sysinst/net.c:1.3	Tue Aug 19 06:47:15 2014
+++ src/usr.sbin/sysinst/net.c	Tue Aug 19 13:01:48 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: net.c,v 1.3 2014/08/19 06:47:15 martin Exp $	*/
+/*	$NetBSD: net.c,v 1.4 2014/08/19 13:01:48 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -264,7 +264,7 @@ get_ifconfig_info(struct net_desc *devs)
 		if (*ignore != NULL)
 			continue;
 
-		strncpy (devs[i].if_dev, buf, STRSIZE);
+		strlcpy (devs[i].if_dev, buf, STRSIZE);
 		i++;
 	}
 	strcpy(devs[i].if_dev, \0);



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:04:45 UTC 2014

Modified Files:
src/usr.sbin/sysinst: main.c

Log Message:
Check return value from getenv() before using the value. Pointed out by
coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/main.c

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

Modified files:

Index: src/usr.sbin/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.3 src/usr.sbin/sysinst/main.c:1.4
--- src/usr.sbin/sysinst/main.c:1.3	Wed Aug  6 09:11:46 2014
+++ src/usr.sbin/sysinst/main.c	Tue Aug 19 13:04:45 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.3 2014/08/06 09:11:46 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.4 2014/08/19 13:04:45 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -390,7 +390,9 @@ toplevel(void)
 	 * XXX must be idempotent, since we get run each time the main
 	 * menu is displayed.
 	 */
-	chdir(getenv(HOME));
+	char *home = getenv(HOME);
+	if (home != NULL)
+		chdir(home);
 	unwind_mounts();
 
 	/* Display banner message in (english, francais, deutsch..) */



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:26:27 UTC 2014

Modified Files:
src/usr.sbin/sysinst: disks.c

Log Message:
Make an invariant more clear to avoid fals positives from coverity scan


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/disks.c

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

Modified files:

Index: src/usr.sbin/sysinst/disks.c
diff -u src/usr.sbin/sysinst/disks.c:1.4 src/usr.sbin/sysinst/disks.c:1.5
--- src/usr.sbin/sysinst/disks.c:1.4	Fri Aug  8 20:24:27 2014
+++ src/usr.sbin/sysinst/disks.c	Tue Aug 19 13:26:27 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: disks.c,v 1.4 2014/08/08 20:24:27 riz Exp $ */
+/*	$NetBSD: disks.c,v 1.5 2014/08/19 13:26:27 martin Exp $ */
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1383,7 +1383,7 @@ get_dkwedges(struct dkwedge_info **dkw, 
 		}
 	}
 
-	if (dkwl.dkwl_nwedges  0)
+	if (dkwl.dkwl_nwedges  0  *dkw != NULL)
 		qsort(*dkw, dkwl.dkwl_nwedges, sizeof(**dkw), get_dkwedges_sort);
 
 	close(fd);



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:30:32 UTC 2014

Modified Files:
src/usr.sbin/sysinst: main.c

Log Message:
if chdir() fails, try chdir /


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/main.c

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

Modified files:

Index: src/usr.sbin/sysinst/main.c
diff -u src/usr.sbin/sysinst/main.c:1.4 src/usr.sbin/sysinst/main.c:1.5
--- src/usr.sbin/sysinst/main.c:1.4	Tue Aug 19 13:04:45 2014
+++ src/usr.sbin/sysinst/main.c	Tue Aug 19 13:30:32 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.4 2014/08/19 13:04:45 martin Exp $	*/
+/*	$NetBSD: main.c,v 1.5 2014/08/19 13:30:32 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -392,7 +392,8 @@ toplevel(void)
 	 */
 	char *home = getenv(HOME);
 	if (home != NULL)
-		chdir(home);
+		if (chdir(home) != 0)
+			(void)chdir(/);
 	unwind_mounts();
 
 	/* Display banner message in (english, francais, deutsch..) */



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:36:04 UTC 2014

Modified Files:
src/usr.sbin/sysinst: util.c

Log Message:
Check return values from stat before comparing contents of the result
structures. Pointed out by coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/usr.sbin/sysinst/util.c

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

Modified files:

Index: src/usr.sbin/sysinst/util.c
diff -u src/usr.sbin/sysinst/util.c:1.3 src/usr.sbin/sysinst/util.c:1.4
--- src/usr.sbin/sysinst/util.c:1.3	Sun Aug 10 16:44:37 2014
+++ src/usr.sbin/sysinst/util.c	Tue Aug 19 13:36:04 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: util.c,v 1.3 2014/08/10 16:44:37 tls Exp $	*/
+/*	$NetBSD: util.c,v 1.4 2014/08/19 13:36:04 martin Exp $	*/
 
 /*
  * Copyright 1997 Piermont Information Systems Inc.
@@ -1105,10 +1105,9 @@ get_and_unpack_sets(int update, msg setu
 	if (!update) {
 		struct stat sb1, sb2;
 
-		stat(target_expand(/), sb1);
-		stat(target_expand(/var), sb2);
-
-		if (sb1.st_dev != sb2.st_dev) {
+		if (stat(target_expand(/), sb1) == 0
+		 stat(target_expand(/var), sb2) == 0
+		 sb1.st_dev != sb2.st_dev) {
 			add_rc_conf(random_file=/etc/entropy-file\n);
 			if (target_file_exists_p(/boot.cfg)) {
 run_program(RUN_CHROOT|RUN_FATAL,



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:41:09 UTC 2014

Modified Files:
src/usr.sbin/sysinst: partman.c

Log Message:
Cosmetic changes trying to appease coverity scan.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/usr.sbin/sysinst/partman.c

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

Modified files:

Index: src/usr.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.4 src/usr.sbin/sysinst/partman.c:1.5
--- src/usr.sbin/sysinst/partman.c:1.4	Fri Aug  8 20:59:35 2014
+++ src/usr.sbin/sysinst/partman.c	Tue Aug 19 13:41:08 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.4 2014/08/08 20:59:35 riz Exp $ */
+/*	$NetBSD: partman.c,v 1.5 2014/08/19 13:41:08 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -1736,7 +1736,7 @@ pm_wedges_fill(pm_devs_t *pm_cur)
 		if (wedges[i].pm == pm_cur  ! wedges[i].allocated)
 			wedges[i].pm = NULL;
 
-	for (i = 0; i  MAXPARTITIONS  i  MAX_WEDGES; i++)
+	for (i = 0; i  min(MAXPARTITIONS,MAX_WEDGES); i++)
 		if (pm_cur-bsdlabel[i].pi_fstype != FS_UNUSED) {
 			current = pm_wedge_getfree();
 			if (current  0) {
@@ -2597,7 +2597,7 @@ pm_upddevlist(menudesc *m, void *arg)
 		if (pm_i-found  0)
 			pm_i-found = 0;
 	/* Detect all present devices */
-	find_disks(partman);
+	(void)find_disks(partman);
 	pm_lvm_find();
 	pm_clean();
 



CVS commit: src/usr.sbin/sysinst

2014-08-19 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Tue Aug 19 13:44:31 UTC 2014

Modified Files:
src/usr.sbin/sysinst: partman.c

Log Message:
Make sure to not dereference a NULL pointer.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.sbin/sysinst/partman.c

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

Modified files:

Index: src/usr.sbin/sysinst/partman.c
diff -u src/usr.sbin/sysinst/partman.c:1.5 src/usr.sbin/sysinst/partman.c:1.6
--- src/usr.sbin/sysinst/partman.c:1.5	Tue Aug 19 13:41:08 2014
+++ src/usr.sbin/sysinst/partman.c	Tue Aug 19 13:44:31 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: partman.c,v 1.5 2014/08/19 13:41:08 martin Exp $ */
+/*	$NetBSD: partman.c,v 1.6 2014/08/19 13:44:31 martin Exp $ */
 
 /*
  * Copyright 2012 Eugene Lozovoy
@@ -2414,17 +2414,18 @@ pm_submenu(menudesc *m, void *arg)
 
 	switch (((part_entry_t *)arg)[m-cursel].type) {
 		case PM_DISK_T:
-			if (pm_cur-gpt) {
+			if (pm_cur != NULL  pm_cur-gpt) {
 process_menu(MENU_pmgptentry, part_num);
 pm_wedges_fill(pm_cur);
-			} else
+			} else {
 process_menu(MENU_pmdiskentry, part_num);
+			}
 			break;
 		case PM_WEDGE_T:
 		case PM_PART_T:
 			part_num = ((part_entry_t *)arg)[m-cursel].dev_num;
 			process_menu(MENU_pmpartentry, part_num);
-			if (pm_cur-gpt)
+			if (pm_cur != NULL  pm_cur-gpt)
 pm_wedges_fill(pm_cur);
 			break;
 		case PM_SPEC_T:



CVS commit: src/sys/arch/sparc/dev

2014-08-19 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Aug 19 14:43:41 UTC 2014

Modified Files:
src/sys/arch/sparc/dev: fd.c

Log Message:
Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().

I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).

Should be pulled up to netbsd-7.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/arch/sparc/dev/fd.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/sparc/dev/fd.c
diff -u src/sys/arch/sparc/dev/fd.c:1.154 src/sys/arch/sparc/dev/fd.c:1.155
--- src/sys/arch/sparc/dev/fd.c:1.154	Fri Jul 25 08:10:34 2014
+++ src/sys/arch/sparc/dev/fd.c	Tue Aug 19 14:43:41 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fd.c,v 1.154 2014/07/25 08:10:34 dholland Exp $	*/
+/*	$NetBSD: fd.c,v 1.155 2014/08/19 14:43:41 tsutsui Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.154 2014/07/25 08:10:34 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: fd.c,v 1.155 2014/08/19 14:43:41 tsutsui Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -2244,7 +2244,7 @@ fdgetdisklabel(dev_t dev)
 	struct cpu_disklabel *clp = fd-sc_dk.dk_cpulabel;
 
 	memset(lp, 0, sizeof(struct disklabel));
-	memset(lp, 0, sizeof(struct cpu_disklabel));
+	memset(clp, 0, sizeof(struct cpu_disklabel));
 
 	lp-d_type = DTYPE_FLOPPY;
 	lp-d_secsize = FD_BSIZE(fd);



CVS commit: src/sys/dev/dm

2014-08-19 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Aug 19 14:43:28 UTC 2014

Modified Files:
src/sys/dev/dm: dm_target_stripe.c

Log Message:
cleanup properly on error.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/dm/dm_target_stripe.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/dm/dm_target_stripe.c
diff -u src/sys/dev/dm/dm_target_stripe.c:1.20 src/sys/dev/dm/dm_target_stripe.c:1.21
--- src/sys/dev/dm/dm_target_stripe.c:1.20	Mon Aug 18 13:16:42 2014
+++ src/sys/dev/dm/dm_target_stripe.c	Tue Aug 19 10:43:28 2014
@@ -1,4 +1,4 @@
-/*$NetBSD: dm_target_stripe.c,v 1.20 2014/08/18 17:16:42 agc Exp $*/
+/*$NetBSD: dm_target_stripe.c,v 1.21 2014/08/19 14:43:28 christos Exp $*/
 
 /*
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -102,6 +102,23 @@ dm_target_stripe_modcmd(modcmd_t cmd, vo
 }
 #endif
 
+static void
+dm_target_stripe_fini(dm_target_stripe_config_t *tsc)
+{
+	dm_target_linear_config_t *tlc;
+
+	if (tsc == NULL)
+		return;
+
+	while ((tlc = TAILQ_FIRST(tsc-stripe_devs)) != NULL) {
+		TAILQ_REMOVE(tsc-stripe_devs, tlc, entries);
+		dm_pdev_decr(tlc-pdev);
+		kmem_free(tlc, sizeof(*tlc));
+	}
+
+	kmem_free(tsc, sizeof(*tsc));
+}
+
 /*
  * Init function called from dm_table_load_ioctl.
  * DM_STRIPE_DEV_OFFSET should always hold the index of the first device-offset
@@ -157,8 +174,8 @@ dm_target_stripe_init(dm_dev_t * dmv, vo
 
 		tlc = kmem_alloc(sizeof(*tlc), KM_NOSLEEP);
 		if ((tlc-pdev = dm_pdev_insert(argv[strpi])) == NULL) {
-			kmem_free(tsc, sizeof(*tsc));
 			kmem_free(tlc, sizeof(*tlc));
+			dm_target_stripe_fini(tsc);
 			return ENOENT;
 		}
 		tlc-offset = atoi(argv[strpi+1]);
@@ -295,27 +312,12 @@ dm_target_stripe_sync(dm_table_entry_t *
 int
 dm_target_stripe_destroy(dm_table_entry_t * table_en)
 {
-	dm_target_stripe_config_t *tsc;
-	dm_target_linear_config_t *tlc;
-
-	tsc = table_en-target_config;
-
-	if (tsc == NULL)
-		return 0;
-
-	while ((tlc = TAILQ_FIRST(tsc-stripe_devs)) != NULL) {
-		TAILQ_REMOVE(tsc-stripe_devs, tlc, entries);
-		dm_pdev_decr(tlc-pdev);
-		kmem_free(tlc, sizeof(*tlc));
-	}
+	dm_target_stripe_fini(table_en-target_config);
 
 	/* Unbusy target so we can unload it */
 	dm_target_unbusy(table_en-target);
 
-	kmem_free(tsc, sizeof(*tsc));
-
 	table_en-target_config = NULL;
-
 	return 0;
 }
 /* Doesn't not need to do anything here. */



CVS commit: src/lib/libperfuse

2014-08-19 Thread Emmanuel Dreyfus
Module Name:src
Committed By:   manu
Date:   Tue Aug 19 15:29:14 UTC 2014

Modified Files:
src/lib/libperfuse: ops.c

Log Message:
Remove usless warning that happens often with direct IO


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/lib/libperfuse/ops.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/libperfuse/ops.c
diff -u src/lib/libperfuse/ops.c:1.68 src/lib/libperfuse/ops.c:1.69
--- src/lib/libperfuse/ops.c:1.68	Sat Aug 16 16:31:15 2014
+++ src/lib/libperfuse/ops.c	Tue Aug 19 15:29:14 2014
@@ -1,4 +1,4 @@
-/*  $NetBSD: ops.c,v 1.68 2014/08/16 16:31:15 manu Exp $ */
+/*  $NetBSD: ops.c,v 1.69 2014/08/19 15:29:14 manu Exp $ */
 
 /*-
  *  Copyright (c) 2010-2011 Emmanuel Dreyfus. All rights reserved.
@@ -3139,8 +3139,6 @@ perfuse_node_write2(struct puffs_usermou
 	 * we get the latest value.
 	 */
 	if (ioflag  PUFFS_IO_APPEND) {
-		DWARNX(%s: PUFFS_IO_APPEND set, untested code, __func__);
-
 		if ((error = perfuse_node_getattr(pu, opc, vap, pcr)) != 0)
 			goto out;
 



CVS commit: src/sys/sys

2014-08-19 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Aug 19 15:46:46 UTC 2014

Modified Files:
src/sys/sys: common_limits.h

Log Message:
Compute utype_max by doing 2ux*type_max+1ux.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/sys/common_limits.h

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

Modified files:

Index: src/sys/sys/common_limits.h
diff -u src/sys/sys/common_limits.h:1.1 src/sys/sys/common_limits.h:1.2
--- src/sys/sys/common_limits.h:1.1	Tue Aug 19 07:27:31 2014
+++ src/sys/sys/common_limits.h	Tue Aug 19 15:46:46 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: common_limits.h,v 1.1 2014/08/19 07:27:31 matt Exp $	*/
+/*	$NetBSD: common_limits.h,v 1.2 2014/08/19 15:46:46 matt Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -34,31 +34,21 @@
 
 #define	CHAR_BIT	__CHAR_BIT__	/* number of bits in a char */
 
-#define	UCHAR_MAX	(2*__SCHAR_MAX__+1) /* max value for an unsigned char */
-#define	SCHAR_MAX	__SCHAR_MAX__	/* max value for a signed char */
 #define SCHAR_MIN	(-__SCHAR_MAX__-1) /* min value for a signed char */
+#define	SCHAR_MAX	__SCHAR_MAX__	/* max value for a signed char */
+#define	UCHAR_MAX	(2*SCHAR_MAX+1)	/* max value for an unsigned char */
 
-#define	USHRT_MAX	(2*__SHRT_MAX__+1) /* max value for an unsigned short */
-#define	SHRT_MAX	__SHRT_MAX__	/* max value for a short */
 #define	SHRT_MIN	(-__SHRT_MAX__-1) /* min value for a short */
+#define	SHRT_MAX	__SHRT_MAX__	/* max value for a short */
+#define	USHRT_MAX	(2*SHRT_MAX+1)	/* max value for an unsigned short */
 
-#if defined(__UINT_MAX__)
-#define	UINT_MAX	__UINT_MAX__	/* max value for an unsigned int */
-#else
-#define	UINT_MAX	0xU	/* max value for an unsigned int */
-#endif
-#define	INT_MAX		__INT_MAX__	/* max value for an int */
 #define	INT_MIN		(-__INT_MAX__-1) /* min value for an int */
+#define	INT_MAX		__INT_MAX__	/* max value for an int */
+#define	UINT_MAX	(2U*INT_MAX+1U)	/* max value for an unsigned int */
 
-#if defined(__ULONG_MAX__)
-#define	ULONG_MAX	__ULONG_MAX__	/* max value for an unsigned long */
-#elif __SIZEOF_LONG__ == __SIZEOF_LONG_LONG__
-#define	ULONG_MAX	0xUL	/* max unsigned long */
-#else
-#define	ULONG_MAX	0xUL	/* max unsigned long */
-#endif
-#define	LONG_MAX	__LONG_MAX__	/* max value for a long */
-#define	LONG_MIN	(-__LONG_MAX__-1)	/* min value for a long */
+#define	LONG_MIN	(-__LONG_MAX__-1L)	/* min value for a long */
+#define	LONG_MAX	__LONG_MAX__		/* max value for a long */
+#define	ULONG_MAX	(2UL*LONG_MAX+1UL)	/* max unsigned long */
 
 #if defined(_POSIX_C_SOURCE) || defined(_XOPEN_SOURCE) || \
 defined(_NETBSD_SOURCE)
@@ -66,13 +56,9 @@
 
 #if defined(_ISOC99_SOURCE) || (__STDC_VERSION__ - 0) = 199901L || \
 defined(_NETBSD_SOURCE)
-#if defined(__ULONG_LONG_MAX__)
-#define	ULLONG_MAX	__ULONG_LONG_MAX__	/* max unsigned long long */
-#else
-#define	ULLONG_MAX	0xULL	/* max unsigned long long */
-#endif
+#define	LLONG_MIN	(-__LONG_LONG_MAX__-1LL) /* min signed long long */
 #define	LLONG_MAX	__LONG_LONG_MAX__	/* max signed long long */
-#define	LLONG_MIN	(-__LONG_LONG_MAX__-1)	/* min signed long long */
+#define	ULLONG_MAX	(2ULL*LLONG_MAX+1ULL)	/* max unsigned long long */
 #endif
 
 #if defined(_NETBSD_SOURCE)



CVS commit: src/sys/arch

2014-08-19 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Tue Aug 19 16:18:15 UTC 2014

Modified Files:
src/sys/arch/arm/samsung: exynos5_loc.c
src/sys/arch/evbarm/odroid: odroid_machdep.c

Log Message:
Implement i2c using gpio for Exynos5 and Odroid-XU


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/arm/samsung/exynos5_loc.c
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/evbarm/odroid/odroid_machdep.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/arm/samsung/exynos5_loc.c
diff -u src/sys/arch/arm/samsung/exynos5_loc.c:1.8 src/sys/arch/arm/samsung/exynos5_loc.c:1.9
--- src/sys/arch/arm/samsung/exynos5_loc.c:1.8	Thu Aug 14 15:46:57 2014
+++ src/sys/arch/arm/samsung/exynos5_loc.c	Tue Aug 19 16:18:15 2014
@@ -91,7 +91,7 @@
 #define IRQ_CPU_NFIQ_1			IRQ_SPI(67)
 #define IRQ_CPU_NFIQ_0			IRQ_SPI(66)
 #define IRQ_TMUIRQ_SPI(65)
-#define IRQ_I2CIRQ_SPI(64)
+#define IRQ_HDMI_I2C			IRQ_SPI(64)
 #define IRQ_I2C7			IRQ_SPI(63)
 #define IRQ_I2C6			IRQ_SPI(62)
 #define IRQ_I2C5			IRQ_SPI(61)
@@ -229,6 +229,16 @@ const struct exyo_locinfo exynos5_locinf
 
 /* flag signal the use of gpio */
 static const struct exyo_locators exynos5_i2c_locators[] = {
+	/* busname, sdabit, slcbit, func */
+	{ iic0, OFFANDSIZE(,I2C0), 0, IRQ_I2C0_USI0, 1 , GPB3, 0, 1, 2 },
+	{ iic1, OFFANDSIZE(,I2C1), 1, IRQ_I2C1_USI1, 1 , GPB3, 2, 3, 2 },
+	{ iic2, OFFANDSIZE(,I2C2), 2, IRQ_I2C2_USI2, 1 , GPA0, 6, 7, 3 },
+	{ iic3, OFFANDSIZE(,I2C3), 3, IRQ_I2C3_USI3, 1 , GPA1, 2, 3, 3 },
+	{ iic4, OFFANDSIZE(,I2C4), 4, IRQ_I2C4,  1 , GPA2, 0, 1, 3 },
+	{ iic5, OFFANDSIZE(,I2C5), 5, IRQ_I2C5,  1 , GPA2, 2, 3, 3 },
+	{ iic6, OFFANDSIZE(,I2C6), 6, IRQ_I2C6,  1 , GPB1, 3, 4, 4 },
+	{ iic7, OFFANDSIZE(,I2C7), 7, IRQ_I2C7,  1 , GPB2, 2, 3, 3 },
+	{ iic8, OFFANDSIZE(,I2CHDMI), 8, IRQ_HDMI_I2C, 0 , , 0, 0, 0 },
 };
 
 

Index: src/sys/arch/evbarm/odroid/odroid_machdep.c
diff -u src/sys/arch/evbarm/odroid/odroid_machdep.c:1.26 src/sys/arch/evbarm/odroid/odroid_machdep.c:1.27
--- src/sys/arch/evbarm/odroid/odroid_machdep.c:1.26	Thu Aug 14 15:57:51 2014
+++ src/sys/arch/evbarm/odroid/odroid_machdep.c	Tue Aug 19 16:18:15 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: odroid_machdep.c,v 1.26 2014/08/14 15:57:51 reinoud Exp $ */
+/*	$NetBSD: odroid_machdep.c,v 1.27 2014/08/19 16:18:15 reinoud Exp $ */
 
 /*
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: odroid_machdep.c,v 1.26 2014/08/14 15:57:51 reinoud Exp $);
+__KERNEL_RCSID(0, $NetBSD: odroid_machdep.c,v 1.27 2014/08/19 16:18:15 reinoud Exp $);
 
 #include opt_evbarm_boardtype.h
 #include opt_exynos.h
@@ -720,6 +720,17 @@ odroid_device_register(device_t self, vo
 		/* internal hub IIRC, unknown if this line exists */
 		//prop_dictionary_set_cstring(dict, p3v3_en, GPA1[3]);
 	}
+	if (device_is_a(self, exyoiic)  (IS_EXYNOS5_P())) {
+		/* IIC0 not used (NC) */
+		prop_dictionary_set_bool(dict, iic1_enable, true);
+		prop_dictionary_set_bool(dict, iic2_enable, true);
+		/* IIC3 not used (NC) */
+		prop_dictionary_set_bool(dict, iic4_enable, true);
+		/* IIC5 not used (NC) */
+		/* IIC6 used differently (SCLK used as led1) */
+		/* IIC7 used differently (PWM, though NC)*/
+		/* IIC8 HDMI, not possible trough GPIO */
+	}
 #endif
 }
 



CVS commit: src/sys/arch/sparc64/dev

2014-08-19 Thread John Nemeth
Module Name:src
Committed By:   jnemeth
Date:   Tue Aug 19 18:20:51 UTC 2014

Modified Files:
src/sys/arch/sparc64/dev: fdc.c

Log Message:
Sync with sparc/dev/fd.c:1.155.

Fix panic() on opening fd(4), caused by a wrong pointer passed to memset().

I'm not sure why this 18 year old bug didn't cause problem before
(at least my old 5.99.23 kernel worked), but probably it's triggered
by new gcc 4.8 which might do more aggressive memory allocation.
The problem is found by Nobuyoshi Sato on trying eject(1) against fd(4).

Should be pulled up to netbsd-7.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/sparc64/dev/fdc.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/sparc64/dev/fdc.c
diff -u src/sys/arch/sparc64/dev/fdc.c:1.41 src/sys/arch/sparc64/dev/fdc.c:1.42
--- src/sys/arch/sparc64/dev/fdc.c:1.41	Fri Jul 25 08:10:35 2014
+++ src/sys/arch/sparc64/dev/fdc.c	Tue Aug 19 18:20:51 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: fdc.c,v 1.41 2014/07/25 08:10:35 dholland Exp $	*/
+/*	$NetBSD: fdc.c,v 1.42 2014/08/19 18:20:51 jnemeth Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: fdc.c,v 1.41 2014/07/25 08:10:35 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: fdc.c,v 1.42 2014/08/19 18:20:51 jnemeth Exp $);
 
 #include opt_ddb.h
 #include opt_md.h
@@ -2430,7 +2430,7 @@ fdgetdisklabel(dev_t dev)
 	struct cpu_disklabel *clp = fd-sc_dk.dk_cpulabel;
 
 	memset(lp, 0, sizeof(struct disklabel));
-	memset(lp, 0, sizeof(struct cpu_disklabel));
+	memset(clp, 0, sizeof(struct cpu_disklabel));
 
 	lp-d_type = DTYPE_FLOPPY;
 	lp-d_secsize = FD_BSIZE(fd);



CVS commit: src/sys/arch/arm/omap

2014-08-19 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Aug 20 00:40:33 UTC 2014

Modified Files:
src/sys/arch/arm/omap: omapfb.c

Log Message:
don't blindly assume that PAGE_SIZE == 4kB
Now X works again.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/omap/omapfb.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/arm/omap/omapfb.c
diff -u src/sys/arch/arm/omap/omapfb.c:1.26 src/sys/arch/arm/omap/omapfb.c:1.27
--- src/sys/arch/arm/omap/omapfb.c:1.26	Thu Aug  7 19:05:18 2014
+++ src/sys/arch/arm/omap/omapfb.c	Wed Aug 20 00:40:33 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: omapfb.c,v 1.26 2014/08/07 19:05:18 macallan Exp $	*/
+/*	$NetBSD: omapfb.c,v 1.27 2014/08/20 00:40:33 macallan Exp $	*/
 
 /*
  * Copyright (c) 2010 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: omapfb.c,v 1.26 2014/08/07 19:05:18 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: omapfb.c,v 1.27 2014/08/20 00:40:33 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -256,7 +256,7 @@ omapfb_attach(device_t parent, device_t 
 	}
 
 	/* setup video DMA */
-	sc-sc_vramsize = (12  20) + 0x1000; /* 12MB + CLUT */
+	sc-sc_vramsize = (12  20) + PAGE_SIZE; /* 12MB + CLUT */
 
 	if (bus_dmamem_alloc(sc-sc_dmat, sc-sc_vramsize, 0, 0,
 	sc-sc_dmamem, 1, segs, BUS_DMA_NOWAIT) != 0) {
@@ -271,7 +271,7 @@ omapfb_attach(device_t parent, device_t 
 		aprint_error_dev(sc-sc_dev, failed to map video RAM\n);
 		return;
 	}
-	sc-sc_fbaddr = (uint8_t *)sc-sc_vramaddr + 0x1000;
+	sc-sc_fbaddr = (uint8_t *)sc-sc_vramaddr + PAGE_SIZE;
 	sc-sc_clut = sc-sc_vramaddr;
 
 	if (bus_dmamap_create(sc-sc_dmat, sc-sc_vramsize, 1, sc-sc_vramsize,
@@ -321,7 +321,7 @@ omapfb_attach(device_t parent, device_t 
 	/* we use overlay 1 for the console and X */
 	bus_space_write_4(sc-sc_iot, sc-sc_regh, OMAPFB_DISPC_GLOBAL_ALPHA,
 	0x00ff00ff);
-	sc-sc_fbhwaddr = sc-sc_dmamem-ds_addr + 0x1000;
+	sc-sc_fbhwaddr = sc-sc_dmamem-ds_addr + PAGE_SIZE;
 	bus_space_write_4(sc-sc_iot, sc-sc_regh, OMAPFB_DISPC_VID1_BASE_0,
 	sc-sc_fbhwaddr);
 	bus_space_write_4(sc-sc_iot, sc-sc_regh,
@@ -626,7 +626,7 @@ omapfb_mmap(void *v, void *vs, off_t off
 	/* 'regular' framebuffer mmap()ing */
 	if (offset  sc-sc_vramsize) {
 		pa = bus_dmamem_mmap(sc-sc_dmat, sc-sc_dmamem, 1,
-		offset + 0x1000, prot, BUS_DMA_PREFETCHABLE);
+		offset + PAGE_SIZE, prot, BUS_DMA_PREFETCHABLE);
 		return pa;
 	}
 	return pa;