CVS commit: src/sys/dev/pci

2017-10-23 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Oct 23 23:29:38 UTC 2017

Modified Files:
src/sys/dev/pci: if_wm.c if_wmreg.h

Log Message:
fix wm(4) vlan panic. Reported and tested by Tom Ivar Helbekkmo, thanks.

wm(4) used PRI bits and CFI bit as vlantag by mistake. It is found out
by if_ether.h:r1.67.

XXX need pullup-8


To generate a diff of this commit:
cvs rdiff -u -r1.541 -r1.542 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/pci/if_wmreg.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/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.541 src/sys/dev/pci/if_wm.c:1.542
--- src/sys/dev/pci/if_wm.c:1.541	Mon Oct 23 09:27:21 2017
+++ src/sys/dev/pci/if_wm.c	Mon Oct 23 23:29:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.541 2017/10/23 09:27:21 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.542 2017/10/23 23:29:38 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.541 2017/10/23 09:27:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.542 2017/10/23 23:29:38 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -8108,11 +8108,11 @@ wm_rxdesc_get_vlantag(struct wm_rxqueue 
 	struct wm_softc *sc = rxq->rxq_sc;
 
 	if (sc->sc_type == WM_T_82574)
-		return rxq->rxq_ext_descs[idx].erx_ctx.erxc_vlan;
+		return EXTRXC_VLAN_ID(rxq->rxq_ext_descs[idx].erx_ctx.erxc_vlan);
 	else if ((sc->sc_flags & WM_F_NEWQUEUE) != 0)
-		return rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_vlan;
+		return NQRXC_VLAN_ID(rxq->rxq_nq_descs[idx].nqrx_ctx.nrxc_vlan);
 	else
-		return rxq->rxq_descs[idx].wrx_special;
+		return WRX_VLAN_ID(rxq->rxq_descs[idx].wrx_special);
 }
 
 static inline int

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.103 src/sys/dev/pci/if_wmreg.h:1.104
--- src/sys/dev/pci/if_wmreg.h:1.103	Wed Jul 26 06:48:49 2017
+++ src/sys/dev/pci/if_wmreg.h	Mon Oct 23 23:29:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.103 2017/07/26 06:48:49 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.104 2017/10/23 23:29:38 knakahara Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -208,6 +208,12 @@ typedef union ext_rxdesc {
 #define EXTRXC_STATUS_PKTTYPE_MASK	__BITS(19,16)
 #define EXTRXC_STATUS_PKTTYPE(status)	__SHIFTOUT(status,EXTRXC_STATUS_PKTTYPE_MASK)
 
+#define	EXTRXC_VLAN_ID_MASK	__BITS(11,0)	/* VLAN identifier mask */
+#define	EXTRXC_VLAN_ID(x)	((x) & EXTRXC_VLAN_ID_MASK) /* VLAN identifier */
+#define	EXTRXC_VLAN_CFI		__BIT(12)	/* Canonical Form Indicator */
+#define	EXTRXC_VLAN_PRI_MASK	__BITS(15,13)	/* VLAN priority mask */
+#define	EXTRXC_VLAN_PRI(x)	__SHIFTOUT((x),EXTRXC_VLAN_PRI_MASK) /* VLAN priority */
+
 /* advanced RX descriptor for 82575 and newer */
 typedef union nq_rxdesc {
 	struct {
@@ -330,6 +336,12 @@ typedef union nq_rxdesc {
 #define NQRXC_STATUS_MC		__BIT(19) /* Packet received from Manageability Controller */
 	  /* "MBC" in i350 spec */
 
+#define	NQRXC_VLAN_ID_MASK	__BITS(11,0)	/* VLAN identifier mask */
+#define	NQRXC_VLAN_ID(x)	((x) & NQRXC_VLAN_ID_MASK) /* VLAN identifier */
+#define	NQRXC_VLAN_CFI		__BIT(12)	/* Canonical Form Indicator */
+#define	NQRXC_VLAN_PRI_MASK	__BITS(15,13)	/* VLAN priority mask */
+#define	NQRXC_VLAN_PRI(x)	__SHIFTOUT((x),NQRXC_VLAN_PRI_MASK) /* VLAN priority */
+
 /*
  * The Wiseman transmit descriptor.
  *



CVS import: src/external/public-domain/tz/dist

2017-10-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 24 01:27:51 UTC 2017

Update of /cvsroot/src/external/public-domain/tz/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv27539

Log Message:
Import tzdata2017c from ftp://ftp.iana.org/tz/releases/tzdata2017c.tar.gz

   Northern Cyprus switches from +03 to +02/+03 on 2017-10-29.
   Fiji ends DST 2018-01-14, not 2018-01-21.
   Namibia switches from +01/+02 to +02 on 2018-04-01.
   Sudan switches from +03 to +02 on 2017-11-01.
   Tonga likely switches from +13/+14 to +13 on 2017-11-05.
   Turks & Caicos switches from -04 to -05/-04 on 2018-11-04.
   Some corrections to (mostly ancient) historical data.

Status:

Vendor Tag: TZDATA
Release Tags:   TZDATA2017C

U src/external/public-domain/tz/dist/leap-seconds.list
N src/external/public-domain/tz/dist/calendars
U src/external/public-domain/tz/dist/CONTRIBUTING
U src/external/public-domain/tz/dist/LICENSE
U src/external/public-domain/tz/dist/Makefile
U src/external/public-domain/tz/dist/NEWS
U src/external/public-domain/tz/dist/README
N src/external/public-domain/tz/dist/theory.html
U src/external/public-domain/tz/dist/version
U src/external/public-domain/tz/dist/africa
U src/external/public-domain/tz/dist/antarctica
U src/external/public-domain/tz/dist/asia
U src/external/public-domain/tz/dist/australasia
U src/external/public-domain/tz/dist/europe
U src/external/public-domain/tz/dist/northamerica
U src/external/public-domain/tz/dist/southamerica
U src/external/public-domain/tz/dist/etcetera
U src/external/public-domain/tz/dist/backward
U src/external/public-domain/tz/dist/pacificnew
U src/external/public-domain/tz/dist/systemv
U src/external/public-domain/tz/dist/factory
U src/external/public-domain/tz/dist/backzone
U src/external/public-domain/tz/dist/iso3166.tab
U src/external/public-domain/tz/dist/checklinks.awk
U src/external/public-domain/tz/dist/zone.tab
U src/external/public-domain/tz/dist/leapseconds
U src/external/public-domain/tz/dist/yearistype.sh
U src/external/public-domain/tz/dist/zone1970.tab
U src/external/public-domain/tz/dist/leapseconds.awk
U src/external/public-domain/tz/dist/checktab.awk
U src/external/public-domain/tz/dist/zoneinfo2tdf.pl
N src/external/public-domain/tz/dist/zishrink.awk

No conflicts created by this import



CVS commit: src/external/public-domain/tz/dist

2017-10-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 24 01:28:18 UTC 2017

Modified Files:
src/external/public-domain/tz/dist: TZDATA_VERSION
Removed Files:
src/external/public-domain/tz/dist: Theory

Log Message:
Merge tzdata2017c


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/external/public-domain/tz/dist/TZDATA_VERSION
cvs rdiff -u -r1.1.1.10 -r0 src/external/public-domain/tz/dist/Theory

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

Modified files:

Index: src/external/public-domain/tz/dist/TZDATA_VERSION
diff -u src/external/public-domain/tz/dist/TZDATA_VERSION:1.8 src/external/public-domain/tz/dist/TZDATA_VERSION:1.9
--- src/external/public-domain/tz/dist/TZDATA_VERSION:1.8	Tue Mar 21 19:24:22 2017
+++ src/external/public-domain/tz/dist/TZDATA_VERSION	Tue Oct 24 01:28:18 2017
@@ -1 +1 @@
-tzdata-2017b
+tzdata-2017c



CVS commit: src/doc

2017-10-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 24 01:30:22 UTC 2017

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
Note tzdata2017c


To generate a diff of this commit:
cvs rdiff -u -r1.1478 -r1.1479 src/doc/3RDPARTY
cvs rdiff -u -r1.2325 -r1.2326 src/doc/CHANGES

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.1478 src/doc/3RDPARTY:1.1479
--- src/doc/3RDPARTY:1.1478	Sun Oct 15 06:15:37 2017
+++ src/doc/3RDPARTY	Tue Oct 24 01:30:21 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.1478 2017/10/15 06:15:37 abhinav Exp $
+#	$NetBSD: 3RDPARTY,v 1.1479 2017/10/24 01:30:21 kre Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -1411,8 +1411,8 @@ Notes:
 Added changes from a5 -> a12 manually.
 
 Package:	tz
-Version:	tzcode2017b / tzdata2017b
-Current Vers:	tzcode2017b / tzdata2017b
+Version:	tzcode2017b / tzdata2017c
+Current Vers:	tzcode2017c / tzdata2017c
 Maintainer:	Paul Eggert 
 Archive Site:	ftp://ftp.iana.org/tz/releases/
 Archive Site:	ftp://munnari.oz.au/pub/oldtz/

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2325 src/doc/CHANGES:1.2326
--- src/doc/CHANGES:1.2325	Sat Oct 21 15:20:52 2017
+++ src/doc/CHANGES	Tue Oct 24 01:30:21 2017
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2325 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2326 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -72,3 +72,4 @@ Changes from NetBSD 8.0 to NetBSD 9.0:
 	tmux(1): Imported 2.6. [christos 20171012]
 	amd64: Add support for SMAP. [maxv 20171017]
 	amd64: Add support for USER_LDT. [maxv 20171021]
+	tzdata updated to 2017c [kre 20171024]



CVS commit: [netbsd-7-0] src/doc

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:37:18 UTC 2017

Modified Files:
src/doc [netbsd-7-0]: CHANGES-7.0.3

Log Message:
1506, 1508, 1511, 1516, 1518


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.67 -r1.1.2.68 src/doc/CHANGES-7.0.3

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

Modified files:

Index: src/doc/CHANGES-7.0.3
diff -u src/doc/CHANGES-7.0.3:1.1.2.67 src/doc/CHANGES-7.0.3:1.1.2.68
--- src/doc/CHANGES-7.0.3:1.1.2.67	Tue Oct 17 15:53:19 2017
+++ src/doc/CHANGES-7.0.3	Mon Oct 23 19:37:18 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0.3,v 1.1.2.67 2017/10/17 15:53:19 martin Exp $
+# $NetBSD: CHANGES-7.0.3,v 1.1.2.68 2017/10/23 19:37:18 snj Exp $
 
 A complete list of changes from the NetBSD 7.0.2 release to the NetBSD 7.0.3
 release:
@@ -4997,3 +4997,38 @@ external/bsd/wpa/dist/wpa_supplicant/wnm
 	CVE-2017-13086 CVE-2017-13087 CVE-2017-13088
 	[spz, ticket #1517]
 
+usr.sbin/mtree/only.c1.3
+
+	Don't modify strings stored in hash, otherwise filling up of
+	directory hierarchy stops if the same hash value occurs in
+	directory and leaf.
+
+	Fix the issue that
+	"./usr/share/locale/pl/LC_MESSAGES/gettext-tools.mo" isn't
+	included in sets file in the case of MKUNPRIVED=no.
+	[nakayama, ticket #1506]
+
+external/bsd/nvi/dist/cl/cl_main.c		1.6
+external/bsd/nvi/dist/cl/cl_screen.c		1.6
+
+	Don't garble display when when resizing nvi in xterm.
+	[mlelstv, ticket #1508]
+
+sys/dev/sysmon/sysmon_envsys.c			patch
+
+	Detach the rndsrc before re-attaching it.
+	[pgoyette, ticket #1511]
+
+sbin/resize_ffs/resize_ffs.8			1.18
+sbin/resize_ffs/resize_ffs.c			1.48-1.53
+
+	Fix numerous overflow errors which can lead to superblock
+	corruption on large filesystems. Documentation fixes.
+	[sborrill, ticket #1516]
+
+sys/dev/cgd.c	1.113
+
+	The cgd(4) module requires des and blowfish symbols.
+	PR kern/52630
+	[kamil, ticket #1518]
+



CVS commit: [netbsd-7-1] src/doc

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:46:03 UTC 2017

Modified Files:
src/doc [netbsd-7-1]: CHANGES-7.1.1

Log Message:
1506, 1508, 1511, 1516, 1518


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.35 -r1.1.2.36 src/doc/CHANGES-7.1.1

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

Modified files:

Index: src/doc/CHANGES-7.1.1
diff -u src/doc/CHANGES-7.1.1:1.1.2.35 src/doc/CHANGES-7.1.1:1.1.2.36
--- src/doc/CHANGES-7.1.1:1.1.2.35	Tue Oct 17 15:51:18 2017
+++ src/doc/CHANGES-7.1.1	Mon Oct 23 19:46:03 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.1.1,v 1.1.2.35 2017/10/17 15:51:18 martin Exp $
+# $NetBSD: CHANGES-7.1.1,v 1.1.2.36 2017/10/23 19:46:03 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.1.1
 release:
@@ -3695,3 +3695,38 @@ external/bsd/wpa/dist/wpa_supplicant/wnm
 	CVE-2017-13086 CVE-2017-13087 CVE-2017-13088
 	[spz, ticket #1517]
 
+usr.sbin/mtree/only.c1.3
+
+	Don't modify strings stored in hash, otherwise filling up of
+	directory hierarchy stops if the same hash value occurs in
+	directory and leaf.
+
+	Fix the issue that
+	"./usr/share/locale/pl/LC_MESSAGES/gettext-tools.mo" isn't
+	included in sets file in the case of MKUNPRIVED=no.
+	[nakayama, ticket #1506]
+
+external/bsd/nvi/dist/cl/cl_main.c		1.6
+external/bsd/nvi/dist/cl/cl_screen.c		1.6
+
+	Don't garble display when when resizing nvi in xterm.
+	[mlelstv, ticket #1508]
+
+sys/dev/sysmon/sysmon_envsys.c			patch
+
+	Detach the rndsrc before re-attaching it.
+	[pgoyette, ticket #1511]
+
+sbin/resize_ffs/resize_ffs.8			1.18
+sbin/resize_ffs/resize_ffs.c			1.48-1.53
+
+	Fix numerous overflow errors which can lead to superblock
+	corruption on large filesystems. Documentation fixes.
+	[sborrill, ticket #1516]
+
+sys/dev/cgd.c	1.113
+
+	The cgd(4) module requires des and blowfish symbols.
+	PR kern/52630
+	[kamil, ticket #1518]
+



CVS commit: src/sys/arch

2017-10-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Oct 23 19:36:01 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_platform.c
src/sys/arch/evbarm/conf: mk.sunxi

Log Message:
A couple small adjustments to make big endian (BE8) SUNXI work.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sunxi_platform.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/conf/mk.sunxi

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/sunxi/sunxi_platform.c
diff -u src/sys/arch/arm/sunxi/sunxi_platform.c:1.13 src/sys/arch/arm/sunxi/sunxi_platform.c:1.14
--- src/sys/arch/arm/sunxi/sunxi_platform.c:1.13	Sun Oct 22 20:35:32 2017
+++ src/sys/arch/arm/sunxi/sunxi_platform.c	Mon Oct 23 19:36:01 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_platform.c,v 1.13 2017/10/22 20:35:32 skrll Exp $ */
+/* $NetBSD: sunxi_platform.c,v 1.14 2017/10/23 19:36:01 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -31,7 +31,7 @@
 #include "opt_fdt_arm.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.13 2017/10/22 20:35:32 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_platform.c,v 1.14 2017/10/23 19:36:01 jakllsch Exp $");
 
 #include 
 #include 
@@ -121,10 +121,10 @@ sunxi_platform_early_putchar(char c)
 #define CONSADDR_VA ((CONSADDR - SUNXI_CORE_PBASE) + SUNXI_CORE_VBASE)
 	volatile uint32_t *uartaddr = (volatile uint32_t *)CONSADDR_VA;
 
-	while ((uartaddr[com_lsr] & LSR_TXRDY) == 0)
+	while ((le32toh(uartaddr[com_lsr]) & LSR_TXRDY) == 0)
 		;
 
-	uartaddr[com_data] = c;
+	uartaddr[com_data] = htole32(c);
 #endif
 }
 

Index: src/sys/arch/evbarm/conf/mk.sunxi
diff -u src/sys/arch/evbarm/conf/mk.sunxi:1.2 src/sys/arch/evbarm/conf/mk.sunxi:1.3
--- src/sys/arch/evbarm/conf/mk.sunxi:1.2	Mon Jul 24 19:37:41 2017
+++ src/sys/arch/evbarm/conf/mk.sunxi	Mon Oct 23 19:36:01 2017
@@ -1,4 +1,8 @@
-#	$NetBSD: mk.sunxi,v 1.2 2017/07/24 19:37:41 joerg Exp $
+#	$NetBSD: mk.sunxi,v 1.3 2017/10/23 19:36:01 jakllsch Exp $
+
+.if !empty(MACHINE_ARCH:M*eb)
+EXTRA_LINKFLAGS+=	--be8
+.endif
 
 SYSTEM_FIRST_OBJ=	sunxi_start.o
 SYSTEM_FIRST_SFILE=	${THISARM}/sunxi/sunxi_start.S



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

2017-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 23 21:03:25 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_com.c

Log Message:
Enable clocks and de-assert resets


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/sunxi/sunxi_com.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/sunxi/sunxi_com.c
diff -u src/sys/arch/arm/sunxi/sunxi_com.c:1.2 src/sys/arch/arm/sunxi/sunxi_com.c:1.3
--- src/sys/arch/arm/sunxi/sunxi_com.c:1.2	Thu Jun 29 17:05:26 2017
+++ src/sys/arch/arm/sunxi/sunxi_com.c	Mon Oct 23 21:03:24 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $ */
+/* $NetBSD: sunxi_com.c,v 1.3 2017/10/23 21:03:24 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2017 Jared McNeill 
@@ -28,7 +28,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.2 2017/06/29 17:05:26 jmcneill Exp $");
+__KERNEL_RCSID(1, "$NetBSD: sunxi_com.c,v 1.3 2017/10/23 21:03:24 jmcneill Exp $");
 
 #include 
 #include 
@@ -106,10 +106,18 @@ sunxi_com_attach(device_t parent, device
 	sc->sc_dev = self;
 
 	ssc->ssc_clk = fdtbus_clock_get_index(faa->faa_phandle, 0);
-	ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
-
 	if (ssc->ssc_clk == NULL) {
-		aprint_error(": couldn't get frequency\n");
+		aprint_error(": couldn't get clock\n");
+		return;
+	}
+	if (clk_enable(ssc->ssc_clk) != 0) {
+		aprint_error(": couldn't enable clock\n");
+		return;
+	}
+
+	ssc->ssc_rst = fdtbus_reset_get_index(faa->faa_phandle, 0);
+	if (ssc->ssc_rst && fdtbus_reset_deassert(ssc->ssc_rst) != 0) {
+		aprint_error(": couldn't de-assert reset\n");
 		return;
 	}
 



CVS commit: [netbsd-7] src/doc

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 20:00:18 UTC 2017

Modified Files:
src/doc [netbsd-7]: CHANGES-7.2

Log Message:
1506, 1508, 1510, 1511, 1513-1516, 1518


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.51 -r1.1.2.52 src/doc/CHANGES-7.2

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

Modified files:

Index: src/doc/CHANGES-7.2
diff -u src/doc/CHANGES-7.2:1.1.2.51 src/doc/CHANGES-7.2:1.1.2.52
--- src/doc/CHANGES-7.2:1.1.2.51	Tue Oct 17 15:48:59 2017
+++ src/doc/CHANGES-7.2	Mon Oct 23 20:00:18 2017
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.2,v 1.1.2.51 2017/10/17 15:48:59 martin Exp $
+# $NetBSD: CHANGES-7.2,v 1.1.2.52 2017/10/23 20:00:18 snj Exp $
 
 A complete list of changes from the NetBSD 7.1 release to the NetBSD 7.2
 release:
@@ -4731,3 +4731,61 @@ external/bsd/wpa/dist/wpa_supplicant/wnm
 	[spz, ticket #1517]
 
  
+usr.sbin/mtree/only.c1.3
+
+	Don't modify strings stored in hash, otherwise filling up of
+	directory hierarchy stops if the same hash value occurs in
+	directory and leaf.
+
+	Fix the issue that
+	"./usr/share/locale/pl/LC_MESSAGES/gettext-tools.mo" isn't
+	included in sets file in the case of MKUNPRIVED=no.
+	[nakayama, ticket #1506]
+
+external/bsd/nvi/dist/cl/cl_main.c		1.6
+external/bsd/nvi/dist/cl/cl_screen.c		1.6
+
+	Don't garble display when when resizing nvi in xterm.
+	[mlelstv, ticket #1508]
+
+usr.sbin/syslogd/syslogd.c			1.124
+
+	Use looked up remote host for remote message without a hostname
+	[ginsbach, ticket #1510]
+
+sys/dev/sysmon/sysmon_envsys.c			patch
+
+	Detach the rndsrc before re-attaching it.
+	[pgoyette, ticket #1511]
+
+share/man/man8/veriexec.8			1.5-1.6
+
+	Prune bogus number.
+	Add missing VERIFIED_EXEC_FP_SHA384 option.
+	[sevan, ticket #1513]
+
+sys/fs/msdosfs/msdosfs_vfsops.c			1.128
+
+	Add more sanity checks for BPB parameters. Handle FAT12 format
+	for media with sectors >= 32kByte.  PR 52485.
+	[mlelstv, ticket #1514]
+
+sys/dev/usb/if_athn_usb.c			1.23
+
+	Fix panic on "ifconfig athn0 up"
+	PR/52553 
+	[skrll, ticket #1515]
+
+sbin/resize_ffs/resize_ffs.8			1.18
+sbin/resize_ffs/resize_ffs.c			1.48-1.53
+
+	Fix numerous overflow errors which can lead to superblock
+	corruption on large filesystems. Documentation fixes.
+	[sborrill, ticket #1516]
+
+sys/dev/cgd.c	1.113
+
+	The cgd(4) module requires des and blowfish symbols.
+	PR kern/52630
+	[kamil, ticket #1518]
+



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

2017-10-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Tue Oct 24 02:22:09 UTC 2017

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

Log Message:
Marked zoneinfo/Canada/East-Saskatchewan as obsolete (zone removed from
tzdata 201c) - name does not meet guidelines, and was never needed.


To generate a diff of this commit:
cvs rdiff -u -r1.1163 -r1.1164 src/distrib/sets/lists/base/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/base/mi
diff -u src/distrib/sets/lists/base/mi:1.1163 src/distrib/sets/lists/base/mi:1.1164
--- src/distrib/sets/lists/base/mi:1.1163	Sat Oct 21 02:05:38 2017
+++ src/distrib/sets/lists/base/mi	Tue Oct 24 02:22:09 2017
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1163 2017/10/21 02:05:38 jmcneill Exp $
+# $NetBSD: mi,v 1.1164 2017/10/24 02:22:09 kre Exp $
 #
 # Note:	Don't delete entries from here - mark them as "obsolete" instead,
 #	unless otherwise stated below.
@@ -5640,7 +5640,7 @@
 ./usr/share/zoneinfo/Canada			base-sys-share
 ./usr/share/zoneinfo/Canada/Atlantic		base-sys-share		share
 ./usr/share/zoneinfo/Canada/Central		base-sys-share		share
-./usr/share/zoneinfo/Canada/East-Saskatchewan	base-sys-share		share
+./usr/share/zoneinfo/Canada/East-Saskatchewan	base-obsolete		obsolete
 ./usr/share/zoneinfo/Canada/Eastern		base-sys-share		share
 ./usr/share/zoneinfo/Canada/Mountain		base-sys-share		share
 ./usr/share/zoneinfo/Canada/Newfoundland	base-sys-share		share



CVS commit: src/sys/arch

2017-10-23 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Mon Oct 23 06:00:59 UTC 2017

Modified Files:
src/sys/arch/amd64/stand/prekern: mm.c
src/sys/arch/x86/x86: x86_machdep.c

Log Message:
Add two XXXs, so that people don't get confused, a fifth region is needed
anyway.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/amd64/stand/prekern/mm.c
cvs rdiff -u -r1.99 -r1.100 src/sys/arch/x86/x86/x86_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/amd64/stand/prekern/mm.c
diff -u src/sys/arch/amd64/stand/prekern/mm.c:1.3 src/sys/arch/amd64/stand/prekern/mm.c:1.4
--- src/sys/arch/amd64/stand/prekern/mm.c:1.3	Wed Oct 18 17:12:42 2017
+++ src/sys/arch/amd64/stand/prekern/mm.c	Mon Oct 23 06:00:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: mm.c,v 1.3 2017/10/18 17:12:42 maxv Exp $	*/
+/*	$NetBSD: mm.c,v 1.4 2017/10/23 06:00:59 maxv Exp $	*/
 
 /*
  * Copyright (c) 2017 The NetBSD Foundation, Inc. All rights reserved.
@@ -174,7 +174,7 @@ mm_rand_base()
 
 	size = (NKL2_KIMG_ENTRIES + 1) * NBPD_L2;
 
-	/* yes, this is ridiculous */
+	/* XXX: yes, this is ridiculous, will be fixed soon */
 	rnd = rdtsc();
 	randva = rounddown(KASLR_WINDOW_BASE + rnd % (KASLR_WINDOW_SIZE - size),
 	PAGE_SIZE);

Index: src/sys/arch/x86/x86/x86_machdep.c
diff -u src/sys/arch/x86/x86/x86_machdep.c:1.99 src/sys/arch/x86/x86/x86_machdep.c:1.100
--- src/sys/arch/x86/x86/x86_machdep.c:1.99	Sun Oct 22 01:29:26 2017
+++ src/sys/arch/x86/x86/x86_machdep.c	Mon Oct 23 06:00:59 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: x86_machdep.c,v 1.99 2017/10/22 01:29:26 maya Exp $	*/
+/*	$NetBSD: x86_machdep.c,v 1.100 2017/10/23 06:00:59 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2006, 2007 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.99 2017/10/22 01:29:26 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: x86_machdep.c,v 1.100 2017/10/23 06:00:59 maxv Exp $");
 
 #include "opt_modular.h"
 #include "opt_physmem.h"
@@ -886,7 +886,7 @@ int
 init_x86_vm(paddr_t pa_kend)
 {
 	extern struct bootspace bootspace;
-	paddr_t pa_kstart = bootspace.text.pa;
+	paddr_t pa_kstart = bootspace.text.pa; /* XXX head instead */
 	uint64_t seg_start, seg_end;
 	uint64_t seg_start1, seg_end1;
 	int x;



CVS commit: src/bin/sh

2017-10-23 Thread Robert Elz
Module Name:src
Committed By:   kre
Date:   Mon Oct 23 10:52:07 UTC 2017

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

Log Message:
PR bin/52640  PR bin/52641

Don't delete jobs from the jobs table merely because they finished,
if they are not the job we are waiting upon.   (bin/52640 part 1)

In a sub-shell environment, don't allow wait to find jobs from the
parent shell that had already exited (before the sub-shell was
created) and return status for them as if they are our children.
(bin/52640 part 2)

Don't have the "jobs" command also be an implicit "wait" command
in non-interactive shells.  (bin/52641)

Use WCONTINUED (when it exists) so we can report on stopped jobs that
"mysteriously" move back to running state without the user issuing
a "bg" command (eg: kill -CONT )   Previously they would keep
being reported as stopped until they exited.

When a job is detected as having changed status just as we're
issuing a "jobs" command (i.e.: the change occurred between the last
prompt and the jobs command being entered) don't report it twice,
once from the status change, and then again in the jobs command
output.   Once is enough (keep the jobs output, suppress the other).

Apply some sanity to the way jobs_invalid is processed - ignore it
in getjob() instead of just ignoring it most of the time there, and
instead always check it before calling getjob() in situations where
we can handle only children of the current shell.  This allows the
(totally broken) save/clear/restore of jobs_invalid in jobscmd() to
be done away with (previously an error while in the clear state would
have left jobs_invalid incorrectly cleared - shouldn't have mattered
since jobs_invalid => subshell => error causes exit, but better to be safe).

Add/improve the DEBUG more tracing.

XXX pullup -8


To generate a diff of this commit:
cvs rdiff -u -r1.90 -r1.91 src/bin/sh/jobs.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/jobs.c
diff -u src/bin/sh/jobs.c:1.90 src/bin/sh/jobs.c:1.91
--- src/bin/sh/jobs.c:1.90	Thu Oct 19 01:57:18 2017
+++ src/bin/sh/jobs.c	Mon Oct 23 10:52:07 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: jobs.c,v 1.90 2017/10/19 01:57:18 kre Exp $	*/
+/*	$NetBSD: jobs.c,v 1.91 2017/10/23 10:52:07 kre Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)jobs.c	8.5 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: jobs.c,v 1.90 2017/10/19 01:57:18 kre Exp $");
+__RCSID("$NetBSD: jobs.c,v 1.91 2017/10/23 10:52:07 kre Exp $");
 #endif
 #endif /* not lint */
 
@@ -82,6 +82,14 @@ __RCSID("$NetBSD: jobs.c,v 1.90 2017/10/
 #include "mystring.h"
 
 
+#ifndef	WCONTINUED
+#define	WCONTINUED 0		/* So we can compile on old systems */
+#endif
+#ifndef	WIFCONTINUED
+#define	WIFCONTINUED(x)	(0)		/* ditto */
+#endif
+
+
 static struct job *jobtab;		/* array of jobs */
 static int njobs;			/* size of array */
 static int jobs_invalid;		/* set in child */
@@ -98,6 +106,7 @@ STATIC struct job *getjob(const char *, 
 STATIC int dowait(int, struct job *);
 #define WBLOCK	1
 #define WNOFREE 2
+#define WSILENT 4
 STATIC int jobstatus(const struct job *, int);
 STATIC int waitproc(int, struct job *, int *);
 STATIC void cmdtxt(union node *);
@@ -247,6 +256,8 @@ do_fgcmd(const char *arg_ptr)
 	int i;
 	int status;
 
+	if (jobs_invalid)
+		error("No current jobs");
 	jp = getjob(arg_ptr, 0);
 	if (jp->jobctl == 0)
 		error("job not created under job control");
@@ -339,6 +350,8 @@ bgcmd(int argc, char **argv)
 	int i;
 
 	nextopt("");
+	if (jobs_invalid)
+		error("No current jobs");
 	do {
 		jp = getjob(*argptr, 0);
 		if (jp->jobctl == 0)
@@ -468,7 +481,7 @@ showjob(struct output *out, struct job *
 fmtstr(s + col, 16, "Done");
 		} else {
 #if JOBS
-			if (WIFSTOPPED(ps->status)) 
+			if (WIFSTOPPED(ps->status))
 st = WSTOPSIG(ps->status);
 			else /* WIFSIGNALED(ps->status) */
 #endif
@@ -512,22 +525,21 @@ int
 jobscmd(int argc, char **argv)
 {
 	int mode, m;
-	int sv = jobs_invalid;
 
-	jobs_invalid = 0;
 	mode = 0;
 	while ((m = nextopt("lp")))
 		if (m == 'l')
 			mode = SHOW_PID;
 		else
 			mode = SHOW_PGID;
+	if (!iflag)
+		mode |= SHOW_NO_FREE;
 	if (*argptr)
 		do
 			showjob(out1, getjob(*argptr,0), mode);
 		while (*++argptr);
 	else
 		showjobs(out1, mode);
-	jobs_invalid = sv;
 	return 0;
 }
 
@@ -551,8 +563,8 @@ showjobs(struct output *out, int mode)
 	CTRACE(DBG_JOBS, ("showjobs(%x) called\n", mode));
 
 	/* If not even one one job changed, there is nothing to do */
-	gotpid = dowait(0, NULL);
-	while (dowait(0, NULL) > 0)
+	gotpid = dowait(WSILENT, NULL);
+	while (dowait(WSILENT, NULL) > 0)
 		continue;
 #ifdef JOBS
 	/*
@@ -653,11 +665,20 @@ waitcmd(int argc, char **argv)
 
 	nextopt("");
 
+	/*
+	 * If we have forked, and not yet created any new jobs, then
+	 * we have no children, whatever jobtab claims,
+	 * so simply return in that case.
+	 *
+	 * The return code is 127 if we 

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

2017-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 23 11:06:31 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: files.sunxi sunxi_mmc.c

Log Message:
Change SUNXI_MMC_DEBUG to a bitmask, allowing for isolation of specific
device units. Useful for debugging sdio without seeing debug spam from the
SD card.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/arm/sunxi/files.sunxi
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/arm/sunxi/sunxi_mmc.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/sunxi/files.sunxi
diff -u src/sys/arch/arm/sunxi/files.sunxi:1.36 src/sys/arch/arm/sunxi/files.sunxi:1.37
--- src/sys/arch/arm/sunxi/files.sunxi:1.36	Fri Oct 20 22:29:15 2017
+++ src/sys/arch/arm/sunxi/files.sunxi	Mon Oct 23 11:06:31 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: files.sunxi,v 1.36 2017/10/20 22:29:15 jmcneill Exp $
+#	$NetBSD: files.sunxi,v 1.37 2017/10/23 11:06:31 jmcneill Exp $
 #
 # Configuration info for Allwinner sunxi family SoCs
 #
@@ -114,6 +114,7 @@ file	arch/arm/sunxi/sunxi_com.c		sunxi_c
 device	sunximmc: sdmmcbus
 attach	sunximmc at fdt with sunxi_mmc
 file	arch/arm/sunxi/sunxi_mmc.c		sunxi_mmc
+defparam opt_sunximmc.hSUNXI_MMC_DEBUG
 
 # USB PHY
 device	sunxiusbphy

Index: src/sys/arch/arm/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.12 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.13
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.12	Sun Oct 22 13:57:25 2017
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Mon Oct 23 11:06:31 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.12 2017/10/22 13:57:25 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.13 2017/10/23 11:06:31 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -26,8 +26,10 @@
  * SUCH DAMAGE.
  */
 
+#include "opt_sunximmc.h"
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.12 2017/10/22 13:57:25 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.13 2017/10/23 11:06:31 jmcneill Exp $");
 
 #include 
 #include 
@@ -45,6 +47,17 @@ __KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,
 
 #include 
 
+#ifdef SUNXI_MMC_DEBUG
+static int sunxi_mmc_debug = SUNXI_MMC_DEBUG;
+#define	DPRINTF(dev, fmt, ...)		\
+do {	\
+	if (sunxi_mmc_debug & __BIT(device_unit(dev)))			\
+		device_printf((dev), fmt, ##__VA_ARGS__);		\
+} while (0)
+#else
+#define	DPRINTF(dev, fmt, ...)		((void)0)
+#endif
+
 enum sunxi_mmc_timing {
 	SUNXI_MMC_TIMING_400K,
 	SUNXI_MMC_TIMING_25M,
@@ -472,10 +485,8 @@ sunxi_mmc_intr(void *priv)
 	MMC_WRITE(sc, SUNXI_MMC_IDST, idst);
 	MMC_WRITE(sc, SUNXI_MMC_RINT, rint);
 
-#ifdef SUNXI_MMC_DEBUG
-	device_printf(sc->sc_dev, "mmc intr idst=%08X rint=%08X\n",
+	DPRINTF(sc->sc_dev, "mmc intr idst=%08X rint=%08X\n",
 	idst, rint);
-#endif
 
 	if (idst != 0) {
 		sc->sc_idma_idst |= idst;
@@ -538,9 +549,7 @@ sunxi_mmc_host_reset(sdmmc_chipset_handl
 	struct sunxi_mmc_softc *sc = sch;
 	int retry = 1000;
 
-#ifdef SUNXI_MMC_DEBUG
-	aprint_normal_dev(sc->sc_dev, "host reset\n");
-#endif
+	DPRINTF(sc->sc_dev, "host reset\n");
 
 	MMC_WRITE(sc, SUNXI_MMC_GCTRL,
 	MMC_READ(sc, SUNXI_MMC_GCTRL) | SUNXI_MMC_GCTRL_RESET);
@@ -621,9 +630,7 @@ sunxi_mmc_update_clock(struct sunxi_mmc_
 	uint32_t cmd;
 	int retry;
 
-#ifdef SUNXI_MMC_DEBUG
-	aprint_normal_dev(sc->sc_dev, "update clock\n");
-#endif
+	DPRINTF(sc->sc_dev, "update clock\n");
 
 	cmd = SUNXI_MMC_CMD_START |
 	  SUNXI_MMC_CMD_UPCLK_ONLY |
@@ -638,24 +645,22 @@ sunxi_mmc_update_clock(struct sunxi_mmc_
 
 	if (retry == 0) {
 		aprint_error_dev(sc->sc_dev, "timeout updating clock\n");
-#ifdef SUNXI_MMC_DEBUG
-		device_printf(sc->sc_dev, "GCTRL: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "GCTRL: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_GCTRL));
-		device_printf(sc->sc_dev, "CLKCR: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "CLKCR: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_CLKCR));
-		device_printf(sc->sc_dev, "TIMEOUT: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "TIMEOUT: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_TIMEOUT));
-		device_printf(sc->sc_dev, "WIDTH: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "WIDTH: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_WIDTH));
-		device_printf(sc->sc_dev, "CMD: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "CMD: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_CMD));
-		device_printf(sc->sc_dev, "MINT: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "MINT: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_MINT));
-		device_printf(sc->sc_dev, "RINT: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "RINT: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_RINT));
-		device_printf(sc->sc_dev, "STATUS: 0x%08x\n",
+		DPRINTF(sc->sc_dev, "STATUS: 0x%08x\n",
 		MMC_READ(sc, SUNXI_MMC_STATUS));
-#endif
 		return ETIMEDOUT;
 	}
 
@@ -733,9 +738,7 @@ sunxi_mmc_bus_width(sdmmc_chipset_handle
 {
 	struct sunxi_mmc_softc *sc = sch;
 
-#ifdef SUNXI_MMC_DEBUG
-	aprint_normal_dev(sc->sc_dev, "width = %d\n", width);
-#endif
+	DPRINTF(sc->sc_dev, "width = %d\n", 

CVS commit: src/sys/sys

2017-10-23 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Oct 23 11:21:56 UTC 2017

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

Log Message:
Do the second half of the previous half-bump: now welcome to 8.99.5
for real!


To generate a diff of this commit:
cvs rdiff -u -r1.548 -r1.549 src/sys/sys/param.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/param.h
diff -u src/sys/sys/param.h:1.548 src/sys/sys/param.h:1.549
--- src/sys/sys/param.h:1.548	Mon Oct 23 09:35:35 2017
+++ src/sys/sys/param.h	Mon Oct 23 11:21:56 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.548 2017/10/23 09:35:35 msaitoh Exp $	*/
+/*	$NetBSD: param.h,v 1.549 2017/10/23 11:21:56 martin Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	899000500	/* NetBSD 8.99.4 */
+#define	__NetBSD_Version__	899000500	/* NetBSD 8.99.5 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



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

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:21:40 UTC 2017

Modified Files:
src/sys/arch/amiga/dev: if_bah_zbus.c

Log Message:
 Return if bah_attach_subr() failed.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/amiga/dev/if_bah_zbus.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/amiga/dev/if_bah_zbus.c
diff -u src/sys/arch/amiga/dev/if_bah_zbus.c:1.16 src/sys/arch/amiga/dev/if_bah_zbus.c:1.17
--- src/sys/arch/amiga/dev/if_bah_zbus.c:1.16	Fri Oct 30 12:19:08 2015
+++ src/sys/arch/amiga/dev/if_bah_zbus.c	Mon Oct 23 09:21:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bah_zbus.c,v 1.16 2015/10/30 12:19:08 phx Exp $ */
+/*	$NetBSD: if_bah_zbus.c,v 1.17 2017/10/23 09:21:40 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
 #endif
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bah_zbus.c,v 1.16 2015/10/30 12:19:08 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bah_zbus.c,v 1.17 2017/10/23 09:21:40 msaitoh Exp $");
 
 /*
  * Driver frontend for the Commodore Busines Machines and the
@@ -98,6 +98,7 @@ bah_zbus_attach(device_t parent, device_
 	struct bah_zbus_softc *bsc = device_private(self);
 	struct bah_softc *sc = >sc_bah;
 	struct zbus_args *zap = aux;
+	int rv;
 
 	sc->sc_dev = self;
 #if (defined(BAH_DEBUG) && (BAH_DEBUG > 2))
@@ -115,7 +116,11 @@ bah_zbus_attach(device_t parent, device_
 
 	sc->sc_reset = bah_zbus_reset;
 
-	bah_attach_subr(sc);
+	rv = bah_attach_subr(sc);
+	if (rv != 0) {
+		aprint_error_dev(self, "bah_attach_subr failed(%d)\n", rv);
+		return;
+	}
 
 	bsc->sc_isr.isr_intr = bahintr;
 	bsc->sc_isr.isr_arg = sc;



CVS commit: src/sys/net

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:22:51 UTC 2017

Modified Files:
src/sys/net: if_bridge.c

Log Message:
- If if_initialize() failed in the attach function, free resources and return.
- Add some missing frees in bridge_clone_destroy().
- KNF


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/net/if_bridge.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/net/if_bridge.c
diff -u src/sys/net/if_bridge.c:1.135 src/sys/net/if_bridge.c:1.136
--- src/sys/net/if_bridge.c:1.135	Mon Oct  2 07:40:24 2017
+++ src/sys/net/if_bridge.c	Mon Oct 23 09:22:51 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.135 2017/10/02 07:40:24 ozaki-r Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.136 2017/10/23 09:22:51 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.135 2017/10/02 07:40:24 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.136 2017/10/23 09:22:51 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -436,12 +436,23 @@ bridge_clone_create(struct if_clone *ifc
 	ifp->if_dlt = DLT_EN10MB;
 	ifp->if_hdrlen = ETHER_HDR_LEN;
 
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		pserialize_destroy(sc->sc_iflist_psref.bip_psz);
+		mutex_destroy(>sc_iflist_psref.bip_lock);
+		callout_destroy(>sc_brcallout);
+		callout_destroy(>sc_bstpcallout);
+		workqueue_destroy(sc->sc_rtage_wq);
+		bridge_rtable_fini(sc);
+		kmem_free(sc, sizeof(*sc));
+
+		return error;
+	}
 	if_register(ifp);
 
 	if_alloc_sadl(ifp);
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -480,12 +491,13 @@ bridge_clone_destroy(struct ifnet *ifp)
 
 	pserialize_destroy(sc->sc_iflist_psref.bip_psz);
 	mutex_destroy(>sc_iflist_psref.bip_lock);
-
+	callout_destroy(>sc_brcallout);
+	callout_destroy(>sc_bstpcallout);
 	workqueue_destroy(sc->sc_rtage_wq);
-
+	kmem_free(sc->sc_rthash, sizeof(*sc->sc_rthash) * BRIDGE_RTHASH_SIZE);
 	kmem_free(sc, sizeof(*sc));
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -530,7 +542,7 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 		 KAUTH_REQ_NETWORK_INTERFACE_BRIDGE_SETPRIV,
 		 ifd, NULL, NULL);
 		if (error)
-			return (error);
+			return error;
 
 		break;
 	}
@@ -618,7 +630,7 @@ bridge_ioctl(struct ifnet *ifp, u_long c
 
 	splx(s);
 
-	return (error);
+	return error;
 }
 
 /*
@@ -733,7 +745,7 @@ bridge_ioctl_add(struct bridge_softc *sc
 
 	ifs = if_get(req->ifbr_ifsname, );
 	if (ifs == NULL)
-		return (ENOENT);
+		return ENOENT;
 
 	if (ifs->if_bridge == sc) {
 		error = EEXIST;
@@ -807,7 +819,7 @@ bridge_ioctl_add(struct bridge_softc *sc
 		if (bif != NULL)
 			kmem_free(bif, sizeof(*bif));
 	}
-	return (error);
+	return error;
 }
 
 static int
@@ -873,7 +885,7 @@ bridge_ioctl_gifflags(struct bridge_soft
 
 	bif = bridge_lookup_member(sc, req->ifbr_ifsname, );
 	if (bif == NULL)
-		return (ENOENT);
+		return ENOENT;
 
 	req->ifbr_ifsflags = bif->bif_flags;
 	req->ifbr_state = bif->bif_state;
@@ -883,7 +895,7 @@ bridge_ioctl_gifflags(struct bridge_soft
 
 	bridge_release_member(sc, bif, );
 
-	return (0);
+	return 0;
 }
 
 static int
@@ -895,7 +907,7 @@ bridge_ioctl_sifflags(struct bridge_soft
 
 	bif = bridge_lookup_member(sc, req->ifbr_ifsname, );
 	if (bif == NULL)
-		return (ENOENT);
+		return ENOENT;
 
 	if (req->ifbr_ifsflags & IFBIF_STP) {
 		switch (bif->bif_ifp->if_type) {
@@ -907,7 +919,7 @@ bridge_ioctl_sifflags(struct bridge_soft
 		default:
 			/* Nothing else can. */
 			bridge_release_member(sc, bif, );
-			return (EINVAL);
+			return EINVAL;
 		}
 	}
 
@@ -918,7 +930,7 @@ bridge_ioctl_sifflags(struct bridge_soft
 	if (sc->sc_if.if_flags & IFF_RUNNING)
 		bstp_initialization(sc);
 
-	return (0);
+	return 0;
 }
 
 static int
@@ -929,7 +941,7 @@ bridge_ioctl_scache(struct bridge_softc 
 	sc->sc_brtmax = param->ifbrp_csize;
 	bridge_rttrim(sc);
 
-	return (0);
+	return 0;
 }
 
 static int
@@ -939,7 +951,7 @@ bridge_ioctl_gcache(struct bridge_softc 
 
 	param->ifbrp_csize = sc->sc_brtmax;
 
-	return (0);
+	return 0;
 }
 
 static int
@@ -1023,7 +1035,7 @@ bridge_ioctl_rts(struct bridge_softc *sc
 	int count = 0, error = 0, len;
 
 	if (bac->ifbac_len == 0)
-		return (0);
+		return 0;
 
 	BRIDGE_RT_LOCK(sc);
 
@@ -1051,7 +1063,7 @@ bridge_ioctl_rts(struct bridge_softc *sc
 	BRIDGE_RT_UNLOCK(sc);
 
 	bac->ifbac_len = sizeof(bareq) * count;
-	return (error);
+	return error;
 }
 
 static int
@@ -1064,14 +1076,14 @@ bridge_ioctl_saddr(struct bridge_softc *
 
 	bif = bridge_lookup_member(sc, req->ifba_ifsname, );
 	if (bif == NULL)
-		return (ENOENT);
+		return ENOENT;
 
 	error = bridge_rtupdate(sc, req->ifba_dst, bif->bif_ifp, 1,
 	req->ifba_flags);
 
 	bridge_release_member(sc, bif, );
 
-	return (error);
+	return error;
 }
 
 static int
@@ -1081,7 +1093,7 @@ bridge_ioctl_sto(struct bridge_softc *sc
 
 	sc->sc_brttimeout = 

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

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:23:25 UTC 2017

Modified Files:
src/sys/arch/arm/broadcom: bcm53xx_eth.c

Log Message:
 If error occured in bcmeth_ccb_attach(), free resources and return.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/arch/arm/broadcom/bcm53xx_eth.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/broadcom/bcm53xx_eth.c
diff -u src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.29 src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.30
--- src/sys/arch/arm/broadcom/bcm53xx_eth.c:1.29	Thu Dec 15 09:28:02 2016
+++ src/sys/arch/arm/broadcom/bcm53xx_eth.c	Mon Oct 23 09:23:25 2017
@@ -35,7 +35,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.29 2016/12/15 09:28:02 ozaki-r Exp $");
+__KERNEL_RCSID(1, "$NetBSD: bcm53xx_eth.c,v 1.30 2017/10/23 09:23:25 msaitoh Exp $");
 
 #include 
 #include 
@@ -321,45 +321,52 @@ bcmeth_ccb_attach(device_t parent, devic
 	error = bcmeth_rxq_attach(sc, >sc_rxq, 0);
 	if (error) {
 		aprint_error(": failed to init rxq: %d\n", error);
-		return;
+		goto fail_1;
 	}
 
 	error = bcmeth_txq_attach(sc, >sc_txq, 0);
 	if (error) {
 		aprint_error(": failed to init txq: %d\n", error);
-		return;
+		goto fail_1;
 	}
 
 	error = bcmeth_mapcache_create(sc, >sc_rx_mapcache, 
 	BCMETH_MAXRXMBUFS, MCLBYTES, BCMETH_NRXSEGS);
 	if (error) {
 		aprint_error(": failed to allocate rx dmamaps: %d\n", error);
-		return;
+		goto fail_1;
 	}
 
 	error = bcmeth_mapcache_create(sc, >sc_tx_mapcache, 
 	BCMETH_MAXTXMBUFS, MCLBYTES, BCMETH_NTXSEGS);
 	if (error) {
 		aprint_error(": failed to allocate tx dmamaps: %d\n", error);
-		return;
+		goto fail_1;
 	}
 
 	error = workqueue_create(>sc_workq, xname, bcmeth_worker, sc,
 	(PRI_USER + MAXPRI_USER) / 2, IPL_NET, WQ_MPSAFE|WQ_PERCPU);
 	if (error) {
 		aprint_error(": failed to create workqueue: %d\n", error);
-		return;
+		goto fail_2;
 	}
 
 	sc->sc_soft_ih = softint_establish(SOFTINT_MPSAFE | SOFTINT_NET,
 	bcmeth_soft_intr, sc);
 
+	if (sc->sc_ih == NULL) {
+		aprint_error_dev(self, "failed to establish interrupt %d\n",
+		 loc->loc_intrs[0]);
+		goto fail_3;
+	}
+
 	sc->sc_ih = intr_establish(loc->loc_intrs[0], IPL_VM, IST_LEVEL,
 	bcmeth_intr, sc);
 
 	if (sc->sc_ih == NULL) {
 		aprint_error_dev(self, "failed to establish interrupt %d\n",
 		 loc->loc_intrs[0]);
+		goto fail_4;
 	} else {
 		aprint_normal_dev(self, "interrupting on irq %d\n",
 		 loc->loc_intrs[0]);
@@ -401,7 +408,12 @@ bcmeth_ccb_attach(device_t parent, devic
 	/*
 	 * Attach the interface.
 	 */
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		goto fail_5;
+	}
 	ether_ifattach(ifp, sc->sc_enaddr);
 	if_register(ifp);
 
@@ -419,6 +431,20 @@ bcmeth_ccb_attach(device_t parent, devic
 	evcnt_attach_dynamic(>sc_ev_rx_badmagic_hi, EVCNT_TYPE_MISC,
 	NULL, xname, "rx badmagic hi");
 #endif
+
+	return;
+
+fail_5:
+	ifmedia_removeall(>sc_media);
+fail_4:
+	intr_disestablish(sc->sc_ih);
+fail_3:
+	softint_disestablish(sc->sc_soft_ih);
+fail_2:	
+	workqueue_destroy(sc->sc_workq);
+fail_1:	
+	mutex_obj_free(sc->sc_lock);
+	mutex_obj_free(sc->sc_hwlock);
 }
 
 static int



CVS commit: src/sys/arch/powerpc/booke/dev

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:23:48 UTC 2017

Modified Files:
src/sys/arch/powerpc/booke/dev: pq3etsec.c

Log Message:
 If error occured in pq3etsec_attach(), free resources and return.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/powerpc/booke/dev/pq3etsec.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/powerpc/booke/dev/pq3etsec.c
diff -u src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.31 src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.32
--- src/sys/arch/powerpc/booke/dev/pq3etsec.c:1.31	Mon Oct  2 01:55:40 2017
+++ src/sys/arch/powerpc/booke/dev/pq3etsec.c	Mon Oct 23 09:23:48 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: pq3etsec.c,v 1.31 2017/10/02 01:55:40 knakahara Exp $	*/
+/*	$NetBSD: pq3etsec.c,v 1.32 2017/10/23 09:23:48 msaitoh Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.31 2017/10/02 01:55:40 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pq3etsec.c,v 1.32 2017/10/23 09:23:48 msaitoh Exp $");
 
 #include 
 #include 
@@ -648,27 +648,27 @@ pq3etsec_attach(device_t parent, device_
 	error = pq3etsec_rxq_attach(sc, >sc_rxq, 0);
 	if (error) {
 		aprint_error(": failed to init rxq: %d\n", error);
-		return;
+		goto fail_1;
 	}
 
 	error = pq3etsec_txq_attach(sc, >sc_txq, 0);
 	if (error) {
 		aprint_error(": failed to init txq: %d\n", error);
-		return;
+		goto fail_2;
 	}
 
 	error = pq3etsec_mapcache_create(sc, >sc_rx_mapcache, 
 	ETSEC_MAXRXMBUFS, MCLBYTES, ETSEC_NRXSEGS);
 	if (error) {
 		aprint_error(": failed to allocate rx dmamaps: %d\n", error);
-		return;
+		goto fail_3;
 	}
 
 	error = pq3etsec_mapcache_create(sc, >sc_tx_mapcache, 
 	ETSEC_MAXTXMBUFS, MCLBYTES, ETSEC_NTXSEGS);
 	if (error) {
 		aprint_error(": failed to allocate tx dmamaps: %d\n", error);
-		return;
+		goto fail_4;
 	}
 
 	sc->sc_tx_ih = intr_establish(cnl->cnl_intrs[0], IPL_VM, IST_ONCHIP,
@@ -676,7 +676,7 @@ pq3etsec_attach(device_t parent, device_
 	if (sc->sc_tx_ih == NULL) {
 		aprint_error(": failed to establish tx interrupt: %d\n",
 		cnl->cnl_intrs[0]);
-		return;
+		goto fail_5;
 	}
 
 	sc->sc_rx_ih = intr_establish(cnl->cnl_intrs[1], IPL_VM, IST_ONCHIP,
@@ -684,7 +684,7 @@ pq3etsec_attach(device_t parent, device_
 	if (sc->sc_rx_ih == NULL) {
 		aprint_error(": failed to establish rx interrupt: %d\n",
 		cnl->cnl_intrs[1]);
-		return;
+		goto fail_6;
 	}
 
 	sc->sc_error_ih = intr_establish(cnl->cnl_intrs[2], IPL_VM, IST_ONCHIP,
@@ -692,7 +692,7 @@ pq3etsec_attach(device_t parent, device_
 	if (sc->sc_error_ih == NULL) {
 		aprint_error(": failed to establish error interrupt: %d\n",
 		cnl->cnl_intrs[2]);
-		return;
+		goto fail_7;
 	}
 
 	int softint_flags = SOFTINT_NET;
@@ -703,7 +703,7 @@ pq3etsec_attach(device_t parent, device_
 	pq3etsec_soft_intr, sc);
 	if (sc->sc_soft_ih == NULL) {
 		aprint_error(": failed to establish soft interrupt\n");
-		return;
+		goto fail_8;
 	}
 
 	/*
@@ -719,7 +719,7 @@ pq3etsec_attach(device_t parent, device_
 		sc->sc_mdio_dev = device_find_by_driver_unit("mdio", mdio);
 		if (sc->sc_mdio_dev == NULL) {
 			aprint_error(": failed to locate mdio device\n");
-			return;
+			goto fail_9;
 		}
 		aprint_normal("\n");
 	}
@@ -734,7 +734,6 @@ pq3etsec_attach(device_t parent, device_
 	sc->sc_ic_tx_count = 16;
 	pq3etsec_set_ic_rx(sc);
 	pq3etsec_set_ic_tx(sc);
-	pq3etsec_sysctl_setup(NULL, sc);
 
 	char enaddr[ETHER_ADDR_LEN] = {
 	[0] = sc->sc_macstnaddr2 >> 16,
@@ -794,7 +793,13 @@ pq3etsec_attach(device_t parent, device_
 	/*
 	 * Attach the interface.
 	 */
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		goto fail_10;
+	}
+	pq3etsec_sysctl_setup(NULL, sc);
 	ether_ifattach(ifp, enaddr);
 	if_register(ifp);
 
@@ -818,6 +823,36 @@ pq3etsec_attach(device_t parent, device_
 	NULL, xname, "rx pause");
 	evcnt_attach_dynamic(>sc_ev_mii_ticks, EVCNT_TYPE_MISC,
 	NULL, xname, "mii ticks");
+	return;
+
+fail_10:
+	ifmedia_removeall(>sc_mii.mii_media);
+	mii_detach(>sc_mii, sc->sc_phy_addr, MII_OFFSET_ANY);
+fail_9:
+	softint_disestablish(sc->sc_soft_ih);
+fail_8:
+	intr_disestablish(sc->sc_error_ih);
+fail_7:
+	intr_disestablish(sc->sc_rx_ih);
+fail_6:
+	intr_disestablish(sc->sc_tx_ih);
+fail_5:
+	pq3etsec_mapcache_destroy(sc, sc->sc_tx_mapcache);
+fail_4:
+	pq3etsec_mapcache_destroy(sc, sc->sc_rx_mapcache);
+fail_3:
+#if 0 /* notyet */
+	pq3etsec_txq_detach(sc);
+#endif
+fail_2:
+#if 0 /* notyet */
+	pq3etsec_rxq_detach(sc);
+#endif
+fail_1:
+	callout_destroy(>sc_mii_callout);
+	mutex_obj_free(sc->sc_lock);
+	mutex_obj_free(sc->sc_hwlock);
+	bus_space_unmap(sc->sc_bst, sc->sc_bsh, cnl->cnl_size);
 }
 
 static uint64_t



CVS commit: src/sys/dev

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:27:21 UTC 2017

Modified Files:
src/sys/dev/ic: bwi.c
src/sys/dev/pci: if_wm.c
src/sys/dev/usb: if_upl.c

Log Message:
 If if_initialize() failed in the attach function, return.


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/ic/bwi.c
cvs rdiff -u -r1.540 -r1.541 src/sys/dev/pci/if_wm.c
cvs rdiff -u -r1.59 -r1.60 src/sys/dev/usb/if_upl.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/bwi.c
diff -u src/sys/dev/ic/bwi.c:1.32 src/sys/dev/ic/bwi.c:1.33
--- src/sys/dev/ic/bwi.c:1.32	Sat Jul 29 01:19:29 2017
+++ src/sys/dev/ic/bwi.c	Mon Oct 23 09:27:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: bwi.c,v 1.32 2017/07/29 01:19:29 riastradh Exp $	*/
+/*	$NetBSD: bwi.c,v 1.33 2017/10/23 09:27:21 msaitoh Exp $	*/
 /*	$OpenBSD: bwi.c,v 1.74 2008/02/25 21:13:30 mglocker Exp $	*/
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.32 2017/07/29 01:19:29 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bwi.c,v 1.33 2017/10/23 09:27:21 msaitoh Exp $");
 
 #include 
 #include 
@@ -1021,7 +1021,12 @@ bwi_attach(struct bwi_softc *sc)
 
 	ic->ic_updateslot = bwi_updateslot;
 
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		goto fail;
+	}
 	ieee80211_ifattach(ic);
 	ifp->if_percpuq = if_percpuq_create(ifp);
 	if_register(ifp);

Index: src/sys/dev/pci/if_wm.c
diff -u src/sys/dev/pci/if_wm.c:1.540 src/sys/dev/pci/if_wm.c:1.541
--- src/sys/dev/pci/if_wm.c:1.540	Fri Oct 20 09:26:13 2017
+++ src/sys/dev/pci/if_wm.c	Mon Oct 23 09:27:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wm.c,v 1.540 2017/10/20 09:26:13 msaitoh Exp $	*/
+/*	$NetBSD: if_wm.c,v 1.541 2017/10/23 09:27:21 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002, 2003, 2004 Wasabi Systems, Inc.
@@ -83,7 +83,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.540 2017/10/20 09:26:13 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_wm.c,v 1.541 2017/10/23 09:27:21 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_net_mpsafe.h"
@@ -2753,7 +2753,12 @@ alloc_retry:
 #endif
 
 	/* Attach the interface. */
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		return; /* Error */
+	}
 	sc->sc_ipq = if_percpuq_create(>sc_ethercom.ec_if);
 	ether_ifattach(ifp, enaddr);
 	if_register(ifp);

Index: src/sys/dev/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.59 src/sys/dev/usb/if_upl.c:1.60
--- src/sys/dev/usb/if_upl.c:1.59	Thu Jan 12 18:26:08 2017
+++ src/sys/dev/usb/if_upl.c	Mon Oct 23 09:27:21 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.59 2017/01/12 18:26:08 maya Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.60 2017/10/23 09:27:21 msaitoh Exp $	*/
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.59 2017/01/12 18:26:08 maya Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.60 2017/10/23 09:27:21 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -228,6 +228,7 @@ upl_attach(device_t parent, device_t sel
 	usb_interface_descriptor_t	*id;
 	usb_endpoint_descriptor_t	*ed;
 	int			i;
+	int			rv;
 
 	DPRINTFN(5,(" : upl_attach: sc=%p, dev=%p", sc, dev));
 
@@ -307,7 +308,12 @@ upl_attach(device_t parent, device_t sel
 	IFQ_SET_READY(>if_snd);
 
 	/* Attach the interface. */
-	if_initialize(ifp);
+	rv = if_initialize(ifp);
+	if (rv != 0) {
+		aprint_error_dev(self, "if_initialize failed(%d)\n", rv);
+		splx(s);
+		return;
+	}
 	if_register(ifp);
 	if_alloc_sadl(ifp);
 



CVS commit: src/sys/dev/ic

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:27:46 UTC 2017

Modified Files:
src/sys/dev/ic: dwc_gmac.c

Log Message:
- If if_initialize() failed in the attach function, free resources and return.
- Add missing dwc_gmac_free_dma_rings() and mutex_destroy() when attach
   failed.


To generate a diff of this commit:
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/ic/dwc_gmac.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/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.40 src/sys/dev/ic/dwc_gmac.c:1.41
--- src/sys/dev/ic/dwc_gmac.c:1.40	Mon Feb 20 07:43:29 2017
+++ src/sys/dev/ic/dwc_gmac.c	Mon Oct 23 09:27:46 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.40 2017/02/20 07:43:29 ozaki-r Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.41 2017/10/23 09:27:46 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.40 2017/02/20 07:43:29 ozaki-r Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.41 2017/10/23 09:27:46 msaitoh Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -146,6 +146,7 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	struct mii_data * const mii = >sc_mii;
 	struct ifnet * const ifp = >sc_ec.ec_if;
 	prop_dictionary_t dict;
+	int rv;
 
 	mutex_init(>sc_mdio_lock, MUTEX_DEFAULT, IPL_NET);
 	sc->sc_mii_clk = mii_clk & 7;
@@ -259,7 +260,9 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	 * Ready, attach interface
 	 */
 	/* Attach the interface. */
-	if_initialize(ifp);
+	rv = if_initialize(ifp);
+	if (rv != 0)
+		goto fail_2;
 	sc->sc_ipq = if_percpuq_create(>sc_ec.ec_if);
 	if_deferred_start_init(ifp, NULL);
 	ether_ifattach(ifp, enaddr);
@@ -277,10 +280,17 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	mutex_exit(sc->sc_lock);
 
 	return;
-
+fail_2:
+	ifmedia_removeall(>mii_media);
+	mii_detach(, MII_PHY_ANY, MII_OFFSET_ANY);
+	mutex_destroy(>sc_txq.t_mtx);
+	mutex_destroy(>sc_rxq.r_mtx);
+	mutex_obj_free(sc->sc_lock);
 fail:
 	dwc_gmac_free_rx_ring(sc, >sc_rxq);
 	dwc_gmac_free_tx_ring(sc, >sc_txq);
+	dwc_gmac_free_dma_rings(sc);
+	mutex_destroy(>sc_mdio_lock);
 }
 
 



CVS commit: src/sys/sys

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:35:35 UTC 2017

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

Log Message:
 Change return value of if_initialize() and if_attach() from void to int.

Welcome to 8.99.4


To generate a diff of this commit:
cvs rdiff -u -r1.547 -r1.548 src/sys/sys/param.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/param.h
diff -u src/sys/sys/param.h:1.547 src/sys/sys/param.h:1.548
--- src/sys/sys/param.h:1.547	Tue Oct 10 17:20:42 2017
+++ src/sys/sys/param.h	Mon Oct 23 09:35:35 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: param.h,v 1.547 2017/10/10 17:20:42 jdolecek Exp $	*/
+/*	$NetBSD: param.h,v 1.548 2017/10/23 09:35:35 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -67,7 +67,7 @@
  *	2.99.9		(299000900)
  */
 
-#define	__NetBSD_Version__	899000400	/* NetBSD 8.99.4 */
+#define	__NetBSD_Version__	899000500	/* NetBSD 8.99.4 */
 
 #define __NetBSD_Prereq__(M,m,p) (M) * 1) + \
 (m) * 100) + (p) * 100) <= __NetBSD_Version__)



CVS commit: src/sys/net

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:21:20 UTC 2017

Modified Files:
src/sys/net: if.c if.h

Log Message:
 if_initalize() and if_attach() failed when resource allocation failed
(e.g. allocating softint). Without this change, it panics. It's bad because
resource shortage really occured when a lot of pseudo interface is created.
To avoid this problem, don't panic and change return value of if_initialize()
and if_attach() to int. Caller fanction will be recover from error cleanly by
checking the return value.


To generate a diff of this commit:
cvs rdiff -u -r1.395 -r1.396 src/sys/net/if.c
cvs rdiff -u -r1.240 -r1.241 src/sys/net/if.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/net/if.c
diff -u src/sys/net/if.c:1.395 src/sys/net/if.c:1.396
--- src/sys/net/if.c:1.395	Tue Jun 27 12:17:27 2017
+++ src/sys/net/if.c	Mon Oct 23 09:21:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.395 2017/06/27 12:17:27 roy Exp $	*/
+/*	$NetBSD: if.c,v 1.396 2017/10/23 09:21:20 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.395 2017/06/27 12:17:27 roy Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.396 2017/10/23 09:21:20 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -670,9 +670,11 @@ skip:
  * ether_ifattach(ifp, enaddr);
  * if_register(ifp);
  */
-void
+int
 if_initialize(ifnet_t *ifp)
 {
+	int rv = 0;
+
 	KASSERT(if_indexlim > 0);
 	TAILQ_INIT(>if_addrlist);
 
@@ -711,8 +713,10 @@ if_initialize(ifnet_t *ifp)
 	if (if_is_link_state_changeable(ifp)) {
 		ifp->if_link_si = softint_establish(SOFTINT_NET,
 		if_link_state_change_si, ifp);
-		if (ifp->if_link_si == NULL)
-			panic("%s: softint_establish() failed", __func__);
+		if (ifp->if_link_si == NULL) {
+			rv = ENOMEM;
+			goto fail;
+		}
 	}
 
 	PSLIST_ENTRY_INIT(ifp, if_pslist_entry);
@@ -724,6 +728,18 @@ if_initialize(ifnet_t *ifp)
 	IFNET_LOCK();
 	if_getindex(ifp);
 	IFNET_UNLOCK();
+
+	return 0;
+
+fail:
+	IF_AFDATA_LOCK_DESTROY(ifp);
+
+	pfil_run_ifhooks(if_pfil, PFIL_IFNET_DETACH, ifp);
+	(void)pfil_head_destroy(ifp->if_pfil);
+
+	IFQ_LOCK_DESTROY(>if_snd);
+
+	return rv;
 }
 
 /*
@@ -1094,13 +1110,19 @@ if_input(struct ifnet *ifp, struct mbuf 
  * migrate softint-based if_input without much changes. If you don't
  * want to enable it, use if_initialize instead.
  */
-void
+int
 if_attach(ifnet_t *ifp)
 {
+	int rv;
+
+	rv = if_initialize(ifp);
+	if (rv != 0)
+		return rv;
 
-	if_initialize(ifp);
 	ifp->if_percpuq = if_percpuq_create(ifp);
 	if_register(ifp);
+
+	return 0;
 }
 
 void

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.240 src/sys/net/if.h:1.241
--- src/sys/net/if.h:1.240	Tue Jun 27 12:17:27 2017
+++ src/sys/net/if.h	Mon Oct 23 09:21:20 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.240 2017/06/27 12:17:27 roy Exp $	*/
+/*	$NetBSD: if.h,v 1.241 2017/10/23 09:21:20 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -923,6 +923,7 @@ do {	\
 
 #define IFQ_LOCK_INIT(ifq)	(ifq)->ifq_lock =			\
 	mutex_obj_alloc(MUTEX_DEFAULT, IPL_NET)
+#define IFQ_LOCK_DESTROY(ifq)	mutex_obj_free((ifq)->ifq_lock)
 #define IFQ_LOCK(ifq)		mutex_enter((ifq)->ifq_lock)
 #define IFQ_UNLOCK(ifq)		mutex_exit((ifq)->ifq_lock)
 
@@ -946,9 +947,9 @@ void if_activate_sadl(struct ifnet *, st
 const struct sockaddr_dl *);
 void	if_set_sadl(struct ifnet *, const void *, u_char, bool);
 void	if_alloc_sadl(struct ifnet *);
-void	if_initialize(struct ifnet *);
+int	if_initialize(struct ifnet *);
 void	if_register(struct ifnet *);
-void	if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
+int	if_attach(struct ifnet *); /* Deprecated. Use if_initialize and if_register */
 void	if_attachdomain(void);
 void	if_deactivate(struct ifnet *);
 bool	if_is_deactivated(const struct ifnet *);



CVS commit: src/sys

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:22:24 UTC 2017

Modified Files:
src/sys/dev/ic: smc90cx6.c smc90cx6var.h
src/sys/net: if_arc.h if_arcsubr.c

Log Message:
 If if_attach() failed in the attach function, return.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/smc90cx6.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/smc90cx6var.h
cvs rdiff -u -r1.22 -r1.23 src/sys/net/if_arc.h
cvs rdiff -u -r1.77 -r1.78 src/sys/net/if_arcsubr.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/smc90cx6.c
diff -u src/sys/dev/ic/smc90cx6.c:1.70 src/sys/dev/ic/smc90cx6.c:1.71
--- src/sys/dev/ic/smc90cx6.c:1.70	Tue May 23 02:43:13 2017
+++ src/sys/dev/ic/smc90cx6.c	Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: smc90cx6.c,v 1.70 2017/05/23 02:43:13 ozaki-r Exp $ */
+/*	$NetBSD: smc90cx6.c,v 1.71 2017/10/23 09:22:24 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: smc90cx6.c,v 1.70 2017/05/23 02:43:13 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smc90cx6.c,v 1.71 2017/10/23 09:22:24 msaitoh Exp $");
 
 /* #define BAHSOFTCOPY */
 #define BAHRETRANSMIT /**/
@@ -140,11 +140,11 @@ void	bah_reconwatch(void *);
 #define GETMEM(off)	bus_space_read_1(bst_m, mem, (off))
 #define PUTMEM(off, v)	bus_space_write_1(bst_m, mem, (off), (v))
 
-void
+int
 bah_attach_subr(struct bah_softc *sc)
 {
 	struct ifnet *ifp = >sc_arccom.ac_if;
-	int s;
+	int s, rv;
 	u_int8_t linkaddress;
 
 	bus_space_tag_t bst_r = sc->sc_bst_r;
@@ -197,7 +197,9 @@ bah_attach_subr(struct bah_softc *sc)
 
 	ifp->if_mtu = ARCMTU;
 
-	arc_ifattach(ifp, linkaddress);
+	rv = arc_ifattach(ifp, linkaddress);
+	if (rv != 0)
+		return rv;
 	if_deferred_start_init(ifp, NULL);
 
 #ifdef BAHSOFTCOPY
@@ -207,6 +209,7 @@ bah_attach_subr(struct bah_softc *sc)
 #endif
 
 	callout_init(>sc_recon_ch, 0);
+	return 0;
 }
 
 /*

Index: src/sys/dev/ic/smc90cx6var.h
diff -u src/sys/dev/ic/smc90cx6var.h:1.11 src/sys/dev/ic/smc90cx6var.h:1.12
--- src/sys/dev/ic/smc90cx6var.h:1.11	Sat Oct 27 17:18:22 2012
+++ src/sys/dev/ic/smc90cx6var.h	Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: smc90cx6var.h,v 1.11 2012/10/27 17:18:22 chs Exp $	*/
+/*	$NetBSD: smc90cx6var.h,v 1.12 2017/10/23 09:22:24 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 1994, 1995, 1998 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@ struct bah_softc {
 	u_char	sc_retransmits[2];	/* unused at the moment */
 };
 
-void	bah_attach_subr(struct bah_softc *);
+int	bah_attach_subr(struct bah_softc *);
 int	bahintr(void *);
 
 #endif

Index: src/sys/net/if_arc.h
diff -u src/sys/net/if_arc.h:1.22 src/sys/net/if_arc.h:1.23
--- src/sys/net/if_arc.h:1.22	Wed Feb 20 17:05:52 2008
+++ src/sys/net/if_arc.h	Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arc.h,v 1.22 2008/02/20 17:05:52 matt Exp $	*/
+/*	$NetBSD: if_arc.h,v 1.23 2017/10/23 09:22:24 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1993
@@ -118,7 +118,7 @@ struct	arccom {
 extern uint8_t arcbroadcastaddr;
 extern int arc_ipmtu;	/* XXX new ip only, no RFC 1051! */
 
-void	arc_ifattach(struct ifnet *, uint8_t);
+int	arc_ifattach(struct ifnet *, uint8_t);
 char	*arc_sprintf(uint8_t *);
 int	arc_isphds(uint8_t);
 #endif

Index: src/sys/net/if_arcsubr.c
diff -u src/sys/net/if_arcsubr.c:1.77 src/sys/net/if_arcsubr.c:1.78
--- src/sys/net/if_arcsubr.c:1.77	Tue Feb 14 03:05:06 2017
+++ src/sys/net/if_arcsubr.c	Mon Oct 23 09:22:24 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_arcsubr.c,v 1.77 2017/02/14 03:05:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_arcsubr.c,v 1.78 2017/10/23 09:22:24 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1994, 1995 Ignatios Souvatzis
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.77 2017/02/14 03:05:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_arcsubr.c,v 1.78 2017/10/23 09:22:24 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -610,10 +610,11 @@ arc_sprintf(uint8_t *ap)
 /*
  * Perform common duties while attaching to interface list
  */
-void
+int
 arc_ifattach(struct ifnet *ifp, uint8_t lla)
 {
 	struct arccom *ac;
+	int rv;
 
 	ifp->if_type = IFT_ARCNET;
 	ifp->if_addrlen = 1;
@@ -635,10 +636,15 @@ arc_ifattach(struct ifnet *ifp, uint8_t 
 		log(LOG_ERR,"%s: link address 0 reserved for broadcasts.  Please change it and ifconfig %s down up\n",
 		   ifp->if_xname, ifp->if_xname);
 	}
-	if_attach(ifp);
+	rv = if_attach(ifp);
+	if (rv != 0)
+		return rv;
+
 	if_set_sadl(ifp, , sizeof(lla), true);
 
 	ifp->if_broadcastaddr = 
 
 	bpf_attach(ifp, DLT_ARCNET, ARC_HDRLEN);
+
+	return 0;
 }



CVS commit: src/sys/dev/ic

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:25:31 UTC 2017

Modified Files:
src/sys/dev/ic: atw.c

Log Message:
- Free resources correctly on some errors in atw_attach().
- Use apint*() insread of printf() in the attach function.


To generate a diff of this commit:
cvs rdiff -u -r1.161 -r1.162 src/sys/dev/ic/atw.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/atw.c
diff -u src/sys/dev/ic/atw.c:1.161 src/sys/dev/ic/atw.c:1.162
--- src/sys/dev/ic/atw.c:1.161	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/ic/atw.c	Mon Oct 23 09:25:31 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: atw.c,v 1.161 2017/02/02 10:05:35 nonaka Exp $  */
+/*	$NetBSD: atw.c,v 1.162 2017/10/23 09:25:31 msaitoh Exp $  */
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003, 2004 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.161 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: atw.c,v 1.162 2017/10/23 09:25:31 msaitoh Exp $");
 
 
 #include 
@@ -621,7 +621,7 @@ atw_attach(struct atw_softc *sc)
 	atw_reset(sc);
 
 	if (atw_read_srom(sc) == -1)
-		return;
+		goto fail_5;
 
 	sc->sc_rftype = __SHIFTOUT(sc->sc_srom[ATW_SR_CSR20],
 	ATW_SR_RFTYPE_MASK);
@@ -631,14 +631,14 @@ atw_attach(struct atw_softc *sc)
 
 	if (sc->sc_rftype >= __arraycount(type_strings)) {
 		aprint_error_dev(sc->sc_dev, "unknown RF\n");
-		return;
+		goto fail_5;
 	}
 	if (sc->sc_bbptype >= __arraycount(type_strings)) {
 		aprint_error_dev(sc->sc_dev, "unknown BBP\n");
-		return;
+		goto fail_5;
 	}
 
-	printf("%s: %s RF, %s BBP", device_xname(sc->sc_dev),
+	aprint_normal_dev(sc->sc_dev, "%s RF, %s BBP",
 	type_strings[sc->sc_rftype], type_strings[sc->sc_bbptype]);
 
 	/* XXX There exists a Linux driver which seems to use RFType = 0 for
@@ -674,8 +674,8 @@ atw_attach(struct atw_softc *sc)
 	case ATW_BBPTYPE_MARVEL:
 		break;
 	case ATW_C_BBPTYPE_RFMD:
-		printf("%s: ADM8211C MAC/RFMD BBP not supported yet.\n",
-		device_xname(sc->sc_dev));
+		aprint_error_dev(sc->sc_dev,
+		"ADM8211C MAC/RFMD BBP not supported yet.\n");
 		break;
 	}
 
@@ -757,11 +757,12 @@ atw_attach(struct atw_softc *sc)
 	ic->ic_myaddr[5] = __SHIFTOUT(reg, ATW_PAR1_PAB5_MASK);
 
 	if (IEEE80211_ADDR_EQ(ic->ic_myaddr, empty_macaddr)) {
-		printf(" could not get mac address, attach failed\n");
-		return;
+		aprint_error_dev(sc->sc_dev,
+		"could not get mac address, attach failed\n");
+		goto fail_5;
 	}
 
-	printf(" 802.11 address %s\n", ether_sprintf(ic->ic_myaddr));
+	aprint_normal(" 802.11 address %s\n", ether_sprintf(ic->ic_myaddr));
 
 	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 	ifp->if_softc = sc;
@@ -791,7 +792,12 @@ atw_attach(struct atw_softc *sc)
 	 * Call MI attach routines.
 	 */
 
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		goto fail_5;
+	}
 	ieee80211_ifattach(ic);
 	/* Use common softint-based if_input */
 	ifp->if_percpuq = if_percpuq_create(ifp);



CVS commit: src/sys

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:31:18 UTC 2017

Modified Files:
src/sys/arch/usermode/dev: if_veth.c
src/sys/dev/ic: bwfm.c malo.c rt2560.c rt2661.c rt2860.c rtw.c rtwvar.h
wi.c
src/sys/dev/pci: if_ipw.c if_iwn.c if_rtwn.c if_wpi.c
src/sys/dev/pci/ixgbe: ixgbe.c ixv.c
src/sys/dev/scsipi: if_se.c
src/sys/net: if_etherip.c if_gif.c if_vlan.c
src/sys/netinet: ip_carp.c
src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
 If if_initialize() failed in the attach function, free resources and return.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/usermode/dev/if_veth.c
cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/bwfm.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/ic/malo.c
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/ic/rt2560.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/ic/rt2661.c
cvs rdiff -u -r1.28 -r1.29 src/sys/dev/ic/rt2860.c
cvs rdiff -u -r1.126 -r1.127 src/sys/dev/ic/rtw.c
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/ic/rtwvar.h
cvs rdiff -u -r1.243 -r1.244 src/sys/dev/ic/wi.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/pci/if_ipw.c
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/pci/if_iwn.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/pci/if_rtwn.c
cvs rdiff -u -r1.78 -r1.79 src/sys/dev/pci/if_wpi.c
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/pci/ixgbe/ixgbe.c
cvs rdiff -u -r1.72 -r1.73 src/sys/dev/pci/ixgbe/ixv.c
cvs rdiff -u -r1.94 -r1.95 src/sys/dev/scsipi/if_se.c
cvs rdiff -u -r1.38 -r1.39 src/sys/net/if_etherip.c
cvs rdiff -u -r1.130 -r1.131 src/sys/net/if_gif.c
cvs rdiff -u -r1.104 -r1.105 src/sys/net/if_vlan.c
cvs rdiff -u -r1.90 -r1.91 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.72 -r1.73 src/sys/rump/net/lib/libshmif/if_shmem.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/usermode/dev/if_veth.c
diff -u src/sys/arch/usermode/dev/if_veth.c:1.8 src/sys/arch/usermode/dev/if_veth.c:1.9
--- src/sys/arch/usermode/dev/if_veth.c:1.8	Thu Dec 15 09:28:04 2016
+++ src/sys/arch/usermode/dev/if_veth.c	Mon Oct 23 09:31:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_veth.c,v 1.8 2016/12/15 09:28:04 ozaki-r Exp $ */
+/* $NetBSD: if_veth.c,v 1.9 2017/10/23 09:31:17 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.8 2016/12/15 09:28:04 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_veth.c,v 1.9 2017/10/23 09:31:17 msaitoh Exp $");
 
 #include 
 #include 
@@ -102,6 +102,7 @@ veth_attach(device_t parent, device_t se
 	struct veth_softc *sc = device_private(self);
 	struct thunkbus_attach_args *taa = opaque;
 	struct ifnet *ifp = >sc_ec.ec_if;
+	int rv;
 
 	sc->sc_dev = self;
 
@@ -137,7 +138,13 @@ veth_attach(device_t parent, device_t se
 	IFQ_SET_MAXLEN(>if_snd, IFQ_MAXLEN);
 	IFQ_SET_READY(>if_snd);
 
-	if_initialize(ifp);
+	rv = if_initialize(ifp);
+	if (rv != 0) {
+		aprint_error_dev(self, "if_initialize failed(%d)\n", rv);
+		thunk_close(sc->sc_tapfd);
+		pmf_device_deregister(self);
+		return; /* Error */
+	}
 	ether_ifattach(ifp, sc->sc_eaddr);
 	if_register(ifp);
 

Index: src/sys/dev/ic/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.2 src/sys/dev/ic/bwfm.c:1.3
--- src/sys/dev/ic/bwfm.c:1.2	Fri Oct 20 23:38:21 2017
+++ src/sys/dev/ic/bwfm.c	Mon Oct 23 09:31:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.2 2017/10/20 23:38:21 jmcneill Exp $ */
+/* $NetBSD: bwfm.c,v 1.3 2017/10/23 09:31:17 msaitoh Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -232,7 +232,15 @@ bwfm_attach(struct bwfm_softc *sc)
 	IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
 
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		printf("%s: if_initialize failed(%d)\n", DEVNAME(sc), error);
+		pcq_destroy(sc->sc_freetask);
+		workqueue_destroy(sc->sc_taskq);
+
+		return; /* Error */
+	}
+		
 	ieee80211_ifattach(ic);
 	ifp->if_percpuq = if_percpuq_create(ifp);
 	if_deferred_start_init(ifp, NULL);

Index: src/sys/dev/ic/malo.c
diff -u src/sys/dev/ic/malo.c:1.9 src/sys/dev/ic/malo.c:1.10
--- src/sys/dev/ic/malo.c:1.9	Thu Feb  2 10:05:35 2017
+++ src/sys/dev/ic/malo.c	Mon Oct 23 09:31:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: malo.c,v 1.9 2017/02/02 10:05:35 nonaka Exp $ */
+/*	$NetBSD: malo.c,v 1.10 2017/10/23 09:31:17 msaitoh Exp $ */
 /*	$OpenBSD: malo.c,v 1.92 2010/08/27 17:08:00 jsg Exp $ */
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.9 2017/02/02 10:05:35 nonaka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: malo.c,v 1.10 2017/10/23 09:31:17 msaitoh Exp $");
 
 #include 
 #include 
@@ -366,7 +366,7 @@ malo_attach(struct malo_softc *sc)
 {
 	struct ieee80211com *ic = >sc_ic;
 	struct ifnet *ifp = >sc_if;
-	int i;
+	int i, rv;
 
 	/* initialize channel scanning timer */
 	

CVS commit: src/sys/net

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:32:33 UTC 2017

Modified Files:
src/sys/net: if_pppoe.c if_tap.c

Log Message:
 - If if_initialize() failed in the attach function, free resources and return.
 - KNF


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/net/if_pppoe.c
cvs rdiff -u -r1.99 -r1.100 src/sys/net/if_tap.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/net/if_pppoe.c
diff -u src/sys/net/if_pppoe.c:1.128 src/sys/net/if_pppoe.c:1.129
--- src/sys/net/if_pppoe.c:1.128	Thu Oct 12 09:49:43 2017
+++ src/sys/net/if_pppoe.c	Mon Oct 23 09:32:33 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: if_pppoe.c,v 1.128 2017/10/12 09:49:43 knakahara Exp $ */
+/* $NetBSD: if_pppoe.c,v 1.129 2017/10/23 09:32:33 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2002, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.128 2017/10/12 09:49:43 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_pppoe.c,v 1.129 2017/10/23 09:32:33 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "pppoe.h"
@@ -223,7 +223,8 @@ static int pppoe_send_padt(struct ifnet 
 static int pppoe_output(struct pppoe_softc *, struct mbuf *);
 
 /* internal helper functions */
-static struct pppoe_softc * pppoe_find_softc_by_session(u_int, struct ifnet *, krw_t);
+static struct pppoe_softc * pppoe_find_softc_by_session(u_int, struct ifnet *,
+krw_t);
 static struct pppoe_softc * pppoe_find_softc_by_hunique(uint8_t *, size_t,
 struct ifnet *, krw_t);
 static struct mbuf *pppoe_get_mbuf(size_t len);
@@ -293,6 +294,7 @@ static int
 pppoe_clone_create(struct if_clone *ifc, int unit)
 {
 	struct pppoe_softc *sc;
+	int rv;
 
 	sc = malloc(sizeof(struct pppoe_softc), M_DEVBUF, M_WAITOK|M_ZERO);
 
@@ -325,7 +327,13 @@ pppoe_clone_create(struct if_clone *ifc,
 	sc->sc_sppp.pp_tlf = pppoe_tlf;
 	sc->sc_sppp.pp_framebytes = PPPOE_HEADERLEN;	/* framing added to ppp packets */
 
-	if_initialize(>sc_sppp.pp_if);
+	rv = if_initialize(>sc_sppp.pp_if);
+	if (rv != 0) {
+		callout_halt(>sc_timeout, NULL);
+		callout_destroy(>sc_timeout);
+		free(sc, M_DEVBUF);
+		return rv;
+	}
 	sc->sc_sppp.pp_if.if_percpuq = if_percpuq_create(>sc_sppp.pp_if);
 	sppp_attach(>sc_sppp.pp_if);
 	if_register(>sc_sppp.pp_if);
@@ -360,7 +368,6 @@ pppoe_clone_destroy(struct ifnet *ifp)
 	}
 	rw_exit(_softc_list_lock);
 
-
 	bpf_detach(ifp);
 	sppp_detach(>sc_sppp.pp_if);
 	if_detach(ifp);
@@ -379,7 +386,7 @@ pppoe_clone_destroy(struct ifnet *ifp)
 
 	free(sc, M_DEVBUF);
 
-	return (0);
+	return 0;
 }
 
 /*
@@ -634,8 +641,9 @@ pppoe_dispatch_disc_pkt(struct mbuf *m, 
 #endif
 			rcvif = m_get_rcvif_psref(m, );
 			if (rcvif != NULL) {
-sc = pppoe_find_softc_by_hunique(mtod(n, char *) + noff,
-len, rcvif, RW_READER);
+sc = pppoe_find_softc_by_hunique(
+	mtod(n, char *) + noff, len, rcvif,
+	RW_READER);
 			}
 			m_put_rcvif_psref(rcvif, );
 			if (sc != NULL) {
@@ -1015,8 +1023,7 @@ pppoe_data_input(struct mbuf *m)
 		struct mbuf *p;
 
 		printf("%s: pkthdr.len=%d, pppoe.len=%d",
-			sc->sc_sppp.pp_if.if_xname,
-			m->m_pkthdr.len, plen);
+		sc->sc_sppp.pp_if.if_xname, m->m_pkthdr.len, plen);
 		p = m;
 		while (p) {
 			printf(" l=%d", p->m_len);
@@ -1030,7 +1037,10 @@ pppoe_data_input(struct mbuf *m)
 	if (m->m_pkthdr.len < plen)
 		goto drop;
 
-	/* fix incoming interface pointer (not the raw ethernet interface anymore) */
+	/*
+	 *  Fix incoming interface pointer (not the raw ethernet interface
+	 * anymore)
+	 */
 	m_set_rcvif(m, >sc_sppp.pp_if);
 
 	/* pass packet up and account for it */
@@ -1059,7 +1069,8 @@ pppoe_output(struct pppoe_softc *sc, str
 	memset(, 0, sizeof dst);
 	dst.sa_family = AF_UNSPEC;
 	eh = (struct ether_header*)_data;
-	etype = sc->sc_state == PPPOE_STATE_SESSION ? ETHERTYPE_PPPOE : ETHERTYPE_PPPOEDISC;
+	etype = sc->sc_state == PPPOE_STATE_SESSION
+	? ETHERTYPE_PPPOE : ETHERTYPE_PPPOEDISC;
 	eh->ether_type = htons(etype);
 	memcpy(>ether_dhost, >sc_dest, sizeof sc->sc_dest);
 
@@ -1090,7 +1101,7 @@ pppoe_ioctl(struct ifnet *ifp, unsigned 
 		if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE,
 		KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
 		NULL) != 0)
-			return (EPERM);
+			return EPERM;
 		if (parms->eth_ifname[0] != 0) {
 			struct ifnet	*eth_if;
 
@@ -1383,8 +1394,7 @@ pppoe_timeout(void *arg)
 if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
 	printf("%s: failed to send PADI"
 	", error=%d\n",
-	sc->sc_sppp.pp_if.if_xname,
-	err);
+	sc->sc_sppp.pp_if.if_xname, err);
 			}
 			callout_reset(>sc_timeout,
 			PPPOE_DISC_TIMEOUT * (1 + sc->sc_padi_retried),
@@ -1462,7 +1472,8 @@ pppoe_disconnect(struct pppoe_softc *sc)
 		if (sc->sc_sppp.pp_if.if_flags & IFF_DEBUG)
 			printf("%s: disconnecting\n",
 			sc->sc_sppp.pp_if.if_xname);
-		err = 

CVS commit: src/sys/dev/ic

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:25:11 UTC 2017

Modified Files:
src/sys/dev/ic: athn.c

Log Message:
- If if_initialize() failed in athn_attach(), free resources and return.
- Add missing pmf_event_deregister() in athn_detach().


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/ic/athn.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/athn.c
diff -u src/sys/dev/ic/athn.c:1.16 src/sys/dev/ic/athn.c:1.17
--- src/sys/dev/ic/athn.c:1.16	Tue Apr 11 17:27:54 2017
+++ src/sys/dev/ic/athn.c	Mon Oct 23 09:25:11 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: athn.c,v 1.16 2017/04/11 17:27:54 jmcneill Exp $	*/
+/*	$NetBSD: athn.c,v 1.17 2017/10/23 09:25:11 msaitoh Exp $	*/
 /*	$OpenBSD: athn.c,v 1.83 2014/07/22 13:12:11 mpi Exp $	*/
 
 /*-
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.16 2017/04/11 17:27:54 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: athn.c,v 1.17 2017/10/23 09:25:11 msaitoh Exp $");
 
 #ifndef _MODULE
 #include "athn_usb.h"		/* for NATHN_USB */
@@ -349,7 +349,16 @@ athn_attach(struct athn_softc *sc)
 	IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		pmf_event_deregister(sc->sc_dev, PMFE_RADIO_OFF,
+		athn_pmf_wlan_off, false);
+		callout_destroy(>sc_scan_to);
+		callout_destroy(>sc_calib_to);
+		return error;
+	}
 	ieee80211_ifattach(ic);
 	/* Use common softint-based if_input */
 	ifp->if_percpuq = if_percpuq_create(ifp);
@@ -412,6 +421,9 @@ athn_detach(struct athn_softc *sc)
 
 	callout_destroy(>sc_scan_to);
 	callout_destroy(>sc_calib_to);
+
+	pmf_event_deregister(sc->sc_dev, PMFE_RADIO_OFF, athn_pmf_wlan_off,
+	false);
 }
 
 /*



CVS commit: src/sys

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:24:34 UTC 2017

Modified Files:
src/sys/dev/ic: an.c
src/sys/dev/pcmcia: if_malo_pcmcia.c
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
 If error occured in the attach function, free resources and return.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/ic/an.c
cvs rdiff -u -r1.14 -r1.15 src/sys/dev/pcmcia/if_malo_pcmcia.c
cvs rdiff -u -r1.54 -r1.55 src/sys/rump/net/lib/libvirtif/if_virt.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/an.c
diff -u src/sys/dev/ic/an.c:1.65 src/sys/dev/ic/an.c:1.66
--- src/sys/dev/ic/an.c:1.65	Tue May 23 02:19:14 2017
+++ src/sys/dev/ic/an.c	Mon Oct 23 09:24:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: an.c,v 1.65 2017/05/23 02:19:14 ozaki-r Exp $	*/
+/*	$NetBSD: an.c,v 1.66 2017/10/23 09:24:34 msaitoh Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul .  All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.65 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.66 2017/10/23 09:24:34 msaitoh Exp $");
 
 
 #include 
@@ -166,7 +166,7 @@ an_attach(struct an_softc *sc)
 {
 	struct ieee80211com *ic = >sc_ic;
 	struct ifnet *ifp = >sc_if;
-	int i, s;
+	int i, s, rv = 0;
 	struct an_rid_wepkey *akey;
 	int buflen, kid, rid;
 	int chan, chan_min, chan_max;
@@ -176,38 +176,38 @@ an_attach(struct an_softc *sc)
 	an_wait(sc);
 	if (an_reset(sc) != 0) {
 		config_deactivate(sc->sc_dev);
-		splx(s);
-		return 1;
+		rv = 1;
+		goto fail_1;
 	}
 
 	sc->sc_soft_ih = softint_establish(SOFTINT_NET, an_softintr, sc);
 	if (sc->sc_soft_ih == NULL) {
-		splx(s);
 		aprint_error_dev(sc->sc_dev, "failed to establish softint\n");
-		return 1;
+		rv = 1;
+		goto fail_1;
 	}
 
 	/* Load factory config */
 	if (an_cmd(sc, AN_CMD_READCFG, 0) != 0) {
-		splx(s);
 		aprint_error_dev(sc->sc_dev, "failed to load config data\n");
-		return 1;
+		rv = 1;
+		goto fail_2;
 	}
 
 	/* Read the current configuration */
 	buflen = sizeof(sc->sc_config);
 	if (an_read_rid(sc, AN_RID_GENCONFIG, >sc_config, ) != 0) {
-		splx(s);
 		aprint_error_dev(sc->sc_dev, "read config failed\n");
-		return 1;
+		rv = 1;
+		goto fail_2;
 	}
 
 	/* Read the card capabilities */
 	buflen = sizeof(sc->sc_caps);
 	if (an_read_rid(sc, AN_RID_CAPABILITIES, >sc_caps, ) != 0) {
-		splx(s);
 		aprint_error_dev(sc->sc_dev, "read caps failed\n");
-		return 1;
+		rv = 1;
+		goto fail_2;
 	}
 
 #ifdef AN_DEBUG
@@ -317,7 +317,11 @@ an_attach(struct an_softc *sc)
 	/*
 	 * Call MI attach routine.
 	 */
-	if_initialize(ifp);
+	rv = if_initialize(ifp);
+	if (rv != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rv);
+		goto fail_2;
+	}
 	ieee80211_ifattach(ic);
 	ifp->if_percpuq = if_percpuq_create(ifp);
 	if_register(ifp);
@@ -346,6 +350,14 @@ an_attach(struct an_softc *sc)
 
 	ieee80211_announce(ic);
 	return 0;
+
+fail_2:
+	if (sc->sc_soft_ih != NULL)
+		softint_disestablish(sc->sc_soft_ih);
+fail_1:
+	splx(s);
+
+	return rv;
 }
 
 #ifdef AN_DEBUG

Index: src/sys/dev/pcmcia/if_malo_pcmcia.c
diff -u src/sys/dev/pcmcia/if_malo_pcmcia.c:1.14 src/sys/dev/pcmcia/if_malo_pcmcia.c:1.15
--- src/sys/dev/pcmcia/if_malo_pcmcia.c:1.14	Sun Jun 25 12:25:02 2017
+++ src/sys/dev/pcmcia/if_malo_pcmcia.c	Mon Oct 23 09:24:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_malo_pcmcia.c,v 1.14 2017/06/25 12:25:02 maxv Exp $	*/
+/*	$NetBSD: if_malo_pcmcia.c,v 1.15 2017/10/23 09:24:34 msaitoh Exp $	*/
 /*  $OpenBSD: if_malo.c,v 1.65 2009/03/29 21:53:53 sthen Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.14 2017/06/25 12:25:02 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_malo_pcmcia.c,v 1.15 2017/10/23 09:24:34 msaitoh Exp $");
 
 #ifdef _MODULE
 #include 
@@ -307,7 +307,7 @@ cmalo_attach(void *arg)
 	struct malo_softc *sc = arg;
 	struct ieee80211com *ic = >sc_ic;
 	struct ifnet *ifp = >sc_if;
-	int i;
+	int i, rv;
 
 	/* disable interrupts */
 	cmalo_intr_mask(sc, 0);
@@ -318,7 +318,7 @@ cmalo_attach(void *arg)
 	cmalo_fw_load_main(sc) != 0) {
 		/* free firmware */
 		cmalo_fw_free(sc);
-		return;
+		goto fail_1;
 	}
 	sc->sc_flags |= MALO_FW_LOADED;
 
@@ -368,7 +368,11 @@ cmalo_attach(void *arg)
 	}
 
 	/* attach interface */
-	if_initialize(ifp);
+	rv = if_initialize(ifp);
+	if (rv != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n", rv);
+		goto fail_2;
+	}
 	ieee80211_ifattach(ic);
 	/* Use common softint-based if_input */
 	ifp->if_percpuq = if_percpuq_create(ifp);
@@ -386,6 +390,16 @@ cmalo_attach(void *arg)
 
 	/* device attached */
 	sc->sc_flags |= MALO_DEVICE_ATTACHED;
+
+	return;
+
+fail_2:
+	cv_destroy(>sc_cv);
+	mutex_destroy(>sc_mtx);
+	free(sc->sc_cmd, M_DEVBUF);
+	free(sc->sc_data, M_DEVBUF);
+fail_1:
+	cmalo_fw_free(sc);
 }
 
 

CVS commit: src/sys/dev/pci

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:28:13 UTC 2017

Modified Files:
src/sys/dev/pci: if_iwi.c

Log Message:
- If if_initialize() failed in the attach function, free resources and return.
- ifp is always not NULL in iwi_detach(). Check correctly with ifp->if_softc.


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/dev/pci/if_iwi.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/pci/if_iwi.c
diff -u src/sys/dev/pci/if_iwi.c:1.103 src/sys/dev/pci/if_iwi.c:1.104
--- src/sys/dev/pci/if_iwi.c:1.103	Tue May 23 02:19:14 2017
+++ src/sys/dev/pci/if_iwi.c	Mon Oct 23 09:28:13 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwi.c,v 1.103 2017/05/23 02:19:14 ozaki-r Exp $  */
+/*	$NetBSD: if_iwi.c,v 1.104 2017/10/23 09:28:13 msaitoh Exp $  */
 /*	$OpenBSD: if_iwi.c,v 1.111 2010/11/15 19:11:57 damien Exp $	*/
 
 /*-
@@ -19,7 +19,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.103 2017/05/23 02:19:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwi.c,v 1.104 2017/10/23 09:28:13 msaitoh Exp $");
 
 /*-
  * Intel(R) PRO/Wireless 2200BG/2225BG/2915ABG driver
@@ -367,7 +367,13 @@ iwi_attach(device_t parent, device_t sel
 	IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
 
-	if_initialize(ifp);
+	error = if_initialize(ifp);
+	if (error != 0) {
+		ifp->if_softc = NULL; /* For iwi_detach() */
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		error);
+		goto fail;
+	}
 	ieee80211_ifattach(ic);
 	/* Use common softint-based if_input */
 	ifp->if_percpuq = if_percpuq_create(ifp);
@@ -454,16 +460,13 @@ iwi_detach(device_t self, int flags)
 	struct iwi_softc *sc = device_private(self);
 	struct ifnet *ifp = >sc_if;
 
-	pmf_device_deregister(self);
-
-	if (ifp != NULL)
+	if (ifp->if_softc != NULL) {
+		pmf_device_deregister(self);
 		iwi_stop(ifp, 1);
-
-	iwi_free_firmware(sc);
-
-	ieee80211_ifdetach(>sc_ic);
-	if (ifp != NULL)
+		iwi_free_firmware(sc);
+		ieee80211_ifdetach(>sc_ic);
 		if_detach(ifp);
+	}
 
 	iwi_free_cmd_ring(sc, >cmdq);
 	iwi_free_tx_ring(sc, >txq[0]);



CVS commit: src/sys/dev/pci

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:28:38 UTC 2017

Modified Files:
src/sys/dev/pci: if_iwm.c

Log Message:
- If if_initialize() failed in the attach function, free resources and return.
- Fix error path in the attach function correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/pci/if_iwm.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/pci/if_iwm.c
diff -u src/sys/dev/pci/if_iwm.c:1.75 src/sys/dev/pci/if_iwm.c:1.76
--- src/sys/dev/pci/if_iwm.c:1.75	Sun Jul 23 10:55:00 2017
+++ src/sys/dev/pci/if_iwm.c	Mon Oct 23 09:28:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_iwm.c,v 1.75 2017/07/23 10:55:00 para Exp $	*/
+/*	$NetBSD: if_iwm.c,v 1.76 2017/10/23 09:28:38 msaitoh Exp $	*/
 /*	OpenBSD: if_iwm.c,v 1.148 2016/11/19 21:07:08 stsp Exp	*/
 #define IEEE80211_NO_HT
 /*
@@ -106,7 +106,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.75 2017/07/23 10:55:00 para Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_iwm.c,v 1.76 2017/10/23 09:28:38 msaitoh Exp $");
 
 #include 
 #include 
@@ -8037,7 +8037,7 @@ iwm_attach(device_t parent, device_t sel
 	err = iwm_alloc_rx_ring(sc, >rxq);
 	if (err) {
 		aprint_error_dev(sc->sc_dev, "could not allocate RX ring\n");
-		goto fail4;
+		goto fail5;
 	}
 
 	/* Clear pending interrupts. */
@@ -8122,7 +8122,12 @@ iwm_attach(device_t parent, device_t sel
 	IFQ_SET_READY(>if_snd);
 	memcpy(ifp->if_xname, DEVNAME(sc), IFNAMSIZ);
 
-	if_initialize(ifp);
+	err = if_initialize(ifp);
+	if (err != 0) {
+		aprint_error_dev(sc->sc_dev, "if_initialize failed(%d)\n",
+		err);
+		goto fail6;
+	}
 #if 0
 	ieee80211_ifattach(ic);
 #else
@@ -8168,10 +8173,10 @@ iwm_attach(device_t parent, device_t sel
 
 	return;
 
-fail4:	while (--txq_i >= 0)
+fail6:	iwm_free_rx_ring(sc, >rxq);
+fail5:	while (--txq_i >= 0)
 		iwm_free_tx_ring(sc, >txq[txq_i]);
-	iwm_free_rx_ring(sc, >rxq);
-	iwm_dma_contig_free(>sched_dma);
+fail4:	iwm_dma_contig_free(>sched_dma);
 fail3:	if (sc->ict_dma.vaddr != NULL)
 		iwm_dma_contig_free(>ict_dma);
 fail2:	iwm_dma_contig_free(>kw_dma);



CVS commit: src/sys/net

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:32:00 UTC 2017

Modified Files:
src/sys/net: if_faith.c if_loop.c if_mpls.c

Log Message:
 If if_attach() failed in the attach function, free resources and return.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/net/if_faith.c
cvs rdiff -u -r1.95 -r1.96 src/sys/net/if_loop.c
cvs rdiff -u -r1.29 -r1.30 src/sys/net/if_mpls.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/net/if_faith.c
diff -u src/sys/net/if_faith.c:1.55 src/sys/net/if_faith.c:1.56
--- src/sys/net/if_faith.c:1.55	Mon Dec 12 03:55:57 2016
+++ src/sys/net/if_faith.c	Mon Oct 23 09:32:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_faith.c,v 1.55 2016/12/12 03:55:57 ozaki-r Exp $	*/
+/*	$NetBSD: if_faith.c,v 1.56 2017/10/23 09:32:00 msaitoh Exp $	*/
 /*	$KAME: if_faith.c,v 1.21 2001/02/20 07:59:26 itojun Exp $	*/
 
 /*
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.55 2016/12/12 03:55:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_faith.c,v 1.56 2017/10/23 09:32:00 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -140,6 +140,7 @@ static int
 faith_clone_create(struct if_clone *ifc, int unit)
 {
 	struct ifnet *ifp;
+	int rv;
 
 	ifp = if_alloc(IFT_FAITH);
 
@@ -154,7 +155,11 @@ faith_clone_create(struct if_clone *ifc,
 	ifp->if_hdrlen = 0;
 	ifp->if_addrlen = 0;
 	ifp->if_dlt = DLT_NULL;
-	if_attach(ifp);
+	rv = if_attach(ifp);
+	if (rv != 0) {
+		if_free(ifp);
+		return rv;
+	}
 	if_alloc_sadl(ifp);
 	bpf_attach(ifp, DLT_NULL, sizeof(u_int));
 	atomic_inc_uint(_count);

Index: src/sys/net/if_loop.c
diff -u src/sys/net/if_loop.c:1.95 src/sys/net/if_loop.c:1.96
--- src/sys/net/if_loop.c:1.95	Thu Sep 21 11:42:17 2017
+++ src/sys/net/if_loop.c	Mon Oct 23 09:32:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_loop.c,v 1.95 2017/09/21 11:42:17 knakahara Exp $	*/
+/*	$NetBSD: if_loop.c,v 1.96 2017/10/23 09:32:00 msaitoh Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,7 +65,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.95 2017/09/21 11:42:17 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_loop.c,v 1.96 2017/10/23 09:32:00 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -175,6 +175,7 @@ static int
 loop_clone_create(struct if_clone *ifc, int unit)
 {
 	struct ifnet *ifp;
+	int rv;
 
 	ifp = if_alloc(IFT_LOOP);
 
@@ -195,7 +196,11 @@ loop_clone_create(struct if_clone *ifc, 
 	IFQ_SET_READY(>if_snd);
 	if (unit == 0)
 		lo0ifp = ifp;
-	if_attach(ifp);
+	rv = if_attach(ifp);
+	if (rv != 0) {
+		if_free(ifp);
+		return rv;
+	}
 	if_alloc_sadl(ifp);
 	bpf_attach(ifp, DLT_NULL, sizeof(u_int));
 #ifdef MBUFTRACE

Index: src/sys/net/if_mpls.c
diff -u src/sys/net/if_mpls.c:1.29 src/sys/net/if_mpls.c:1.30
--- src/sys/net/if_mpls.c:1.29	Mon Dec 12 03:55:57 2016
+++ src/sys/net/if_mpls.c	Mon Oct 23 09:32:00 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mpls.c,v 1.29 2016/12/12 03:55:57 ozaki-r Exp $ */
+/*	$NetBSD: if_mpls.c,v 1.30 2017/10/23 09:32:00 msaitoh Exp $ */
 
 /*
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.29 2016/12/12 03:55:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_mpls.c,v 1.30 2017/10/23 09:32:00 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -149,6 +149,7 @@ static int
 mpls_clone_create(struct if_clone *ifc, int unit)
 {
 	struct mpls_softc *sc;
+	int rv;
 
 	atomic_inc_uint(_count);
 	sc = malloc(sizeof(*sc), M_DEVBUF, M_WAITOK | M_ZERO);
@@ -165,7 +166,12 @@ mpls_clone_create(struct if_clone *ifc, 
 	sc->sc_if.if_output = mpls_output;
 	sc->sc_if.if_ioctl = mpls_ioctl;
 
-	if_attach(>sc_if);
+	rv = if_attach(>sc_if);
+	if (rv != 0) {
+		free(sc, M_DEVBUF);
+		atomic_dec_uint(_count);
+		return rv;
+	}
 	if_alloc_sadl(>sc_if);
 	bpf_attach(>sc_if, DLT_NULL, sizeof(uint32_t));
 	return 0;



CVS commit: src/sys/net

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 09:32:55 UTC 2017

Modified Files:
src/sys/net: if_srt.c if_stf.c

Log Message:
 - If if_attach() failed in the attach function, free resources and return.
 - KNF


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/net/if_srt.c
cvs rdiff -u -r1.101 -r1.102 src/sys/net/if_stf.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/net/if_srt.c
diff -u src/sys/net/if_srt.c:1.26 src/sys/net/if_srt.c:1.27
--- src/sys/net/if_srt.c:1.26	Tue Feb 14 03:05:06 2017
+++ src/sys/net/if_srt.c	Mon Oct 23 09:32:55 2017
@@ -1,8 +1,8 @@
-/* $NetBSD: if_srt.c,v 1.26 2017/02/14 03:05:06 ozaki-r Exp $ */
+/* $NetBSD: if_srt.c,v 1.27 2017/10/23 09:32:55 msaitoh Exp $ */
 /* This file is in the public domain. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.26 2017/02/14 03:05:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_srt.c,v 1.27 2017/10/23 09:32:55 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -88,7 +88,7 @@ update_mtu(struct srt_softc *sc)
 	if (sc->flags & SSF_MTULOCK)
 		return;
 	mtu = 65535;
-	for (i=sc->nrt-1;i>=0;i--) {
+	for (i = sc->nrt-1; i>=0; i--) {
 		r = sc->rts[i];
 		if (r->u.dstifp->if_mtu < mtu)
 			mtu = r->u.dstifp->if_mtu;
@@ -249,12 +249,13 @@ static int
 srt_clone_create(struct if_clone *cl, int unit)
 {
 	struct srt_softc *sc;
+	int rv;
 
 	if (unit < 0 || unit > SRT_MAXUNIT)
 		return ENXIO;
 	if (softcv[unit])
 		return EBUSY;
-	sc = malloc(sizeof(struct srt_softc), M_DEVBUF, M_WAITOK|M_ZERO);
+	sc = malloc(sizeof(struct srt_softc), M_DEVBUF, M_WAITOK | M_ZERO);
 	sc->unit = unit;
 	sc->nrt = 0;
 	sc->rts = 0;
@@ -268,7 +269,13 @@ srt_clone_create(struct if_clone *cl, in
 	sc->intf.if_ioctl = _if_ioctl;
 	sc->intf.if_output = _if_output;
 	sc->intf.if_dlt = DLT_RAW;
-	if_attach(>intf);
+	rv = if_attach(>intf);
+	if (rv != 0) {
+		aprint_error("%s: if_initialize failed(%d)\n",
+		sc->intf.if_xname, rv);
+		free(sc, M_DEVBUF);
+		return rv;
+	}
 	if_alloc_sadl(>intf);
 #ifdef BPFILTER_NOW_AVAILABLE
 	bpf_attach(>intf, 0, 0);
@@ -295,16 +302,16 @@ srt_clone_destroy(struct ifnet *ifp)
 	}
 	if (softcv[sc->unit] != sc) {
 		panic("srt_clone_destroy: bad backpointer ([%d]=%p not %p)\n",
-		sc->unit,(void *)softcv[sc->unit],(void *)sc);
+		sc->unit, (void *)softcv[sc->unit], (void *)sc);
 	}
 	softcv[sc->unit] = 0;
-	free(sc,M_DEVBUF);
+	free(sc, M_DEVBUF);
 	atomic_inc_uint(_count);
 	return 0;
 }
 
 struct if_clone srt_clone =
-IF_CLONE_INITIALIZER("srt",_clone_create,_clone_destroy);
+IF_CLONE_INITIALIZER("srt", _clone_create, _clone_destroy);
 
 void
 srtattach(int n)
@@ -408,8 +415,9 @@ srt_ioctl(dev_t dev, u_long cmd, void *d
 		dr->af = scr->af;
 		dr->srcmatch = scr->srcmatch;
 		dr->srcmask = scr->srcmask;
-		strlcpy(>u.dstifn[0],>u.dstifp->if_xname[0],IFNAMSIZ);
-		memcpy(>dst,>dst,scr->dst.sa.sa_len);
+		strlcpy(>u.dstifn[0], >u.dstifp->if_xname[0],
+		IFNAMSIZ);
+		memcpy(>dst, >dst, scr->dst.sa.sa_len);
 		return 0;
 	case SRT_SETRT:
 		if (! (flag & FWRITE))
@@ -417,7 +425,7 @@ srt_ioctl(dev_t dev, u_long cmd, void *d
 		dr = (struct srt_rt *) data;
 		if (dr->inx > sc->nrt)
 			return EDOM;
-		strlcpy([0],>u.dstifn[0],IFNAMSIZ);
+		strlcpy([0], >u.dstifn[0], IFNAMSIZ);
 		nbuf[IFNAMSIZ-1] = '\0';
 		if (dr->dst.sa.sa_family != dr->af)
 			return EIO;
@@ -460,7 +468,7 @@ srt_ioctl(dev_t dev, u_long cmd, void *d
 		}
 		scr = sc->rts[dr->inx];
 		if (scr == 0) {
-			scr = malloc(sizeof(struct srt_rt),M_DEVBUF,M_WAITOK);
+			scr = malloc(sizeof(struct srt_rt), M_DEVBUF,M_WAITOK);
 			if (scr == 0)
 return ENOBUFS;
 			scr->inx = dr->inx;
@@ -488,7 +496,7 @@ srt_ioctl(dev_t dev, u_long cmd, void *d
 		sc->nrt--;
 		if (i < sc->nrt) {
 			memcpy(sc->rts+i, sc->rts+i+1,
-			(sc->nrt-i)*sizeof(*sc->rts));
+			(sc->nrt-i) * sizeof(*sc->rts));
 		}
 		if (sc->nrt == 0) {
 			free(sc->rts, M_DEVBUF);
@@ -510,7 +518,7 @@ srt_ioctl(dev_t dev, u_long cmd, void *d
 		*(unsigned int *)data = sc->flags | global_flags;
 		return 0;
 	case SRT_SGFLAGS:
-		if ((flag & (FWRITE|FREAD)) != (FWRITE|FREAD))
+		if ((flag & (FWRITE | FREAD)) != (FWRITE | FREAD))
 			return EBADF;
 		o = sc->flags | global_flags;
 		n = *(unsigned int *)data & SSF_UCHG;

Index: src/sys/net/if_stf.c
diff -u src/sys/net/if_stf.c:1.101 src/sys/net/if_stf.c:1.102
--- src/sys/net/if_stf.c:1.101	Mon Dec 12 03:55:57 2016
+++ src/sys/net/if_stf.c	Mon Oct 23 09:32:55 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stf.c,v 1.101 2016/12/12 03:55:57 ozaki-r Exp $	*/
+/*	$NetBSD: if_stf.c,v 1.102 2017/10/23 09:32:55 msaitoh Exp $	*/
 /*	$KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
 
 /*
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.101 2016/12/12 03:55:57 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_stf.c,v 1.102 2017/10/23 09:32:55 msaitoh Exp $");
 
 

CVS commit: src/sys/rump/net/lib/libshmif

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 12:55:26 UTC 2017

Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
 Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.73 -r1.74 src/sys/rump/net/lib/libshmif/if_shmem.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/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.73 src/sys/rump/net/lib/libshmif/if_shmem.c:1.74
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.73	Mon Oct 23 09:31:18 2017
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Mon Oct 23 12:55:26 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_shmem.c,v 1.73 2017/10/23 09:31:18 msaitoh Exp $	*/
+/*	$NetBSD: if_shmem.c,v 1.74 2017/10/23 12:55:26 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.73 2017/10/23 09:31:18 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_shmem.c,v 1.74 2017/10/23 12:55:26 msaitoh Exp $");
 
 #include 
 #include 
@@ -189,7 +189,8 @@ allocif(int unit, struct shmif_sc **scp)
 
 	error = if_initialize(ifp);
 	if (error != 0) {
-		aprint_error("shmif%d: if_initialize failed(%d)\n", unit, rv);
+		aprint_error("shmif%d: if_initialize failed(%d)\n", unit,
+		error);
 		cv_destroy(>sc_cv);
 		mutex_destroy(>sc_mtx);
 		kmem_free(sc, sizeof(*sc));



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

2017-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 23 13:11:17 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
SDIO IO_RW_EXTENDED (CMD53) commands have datalen set but no dmamap. Setup
and use a bounce buffer to service these requests.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/arm/sunxi/sunxi_mmc.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/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.13 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.14
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.13	Mon Oct 23 11:06:31 2017
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Mon Oct 23 13:11:17 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.13 2017/10/23 11:06:31 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.14 2017/10/23 13:11:17 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.13 2017/10/23 11:06:31 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.14 2017/10/23 13:11:17 jmcneill Exp $");
 
 #include 
 #include 
@@ -96,6 +96,7 @@ static void	sunxi_mmc_attach(device_t, d
 static void	sunxi_mmc_attach_i(device_t);
 
 static int	sunxi_mmc_intr(void *);
+static int	sunxi_mmc_dmabounce_setup(struct sunxi_mmc_softc *);
 static int	sunxi_mmc_idma_setup(struct sunxi_mmc_softc *);
 
 static int	sunxi_mmc_host_reset(sdmmc_chipset_handle_t);
@@ -165,6 +166,10 @@ struct sunxi_mmc_softc {
 	int sc_idma_ndesc;
 	void *sc_idma_desc;
 
+	bus_dmamap_t sc_dmabounce_map;
+	void *sc_dmabounce_buf;
+	size_t sc_dmabounce_buflen;
+
 	uint32_t sc_intr_rint;
 	uint32_t sc_idma_idst;
 
@@ -321,7 +326,8 @@ sunxi_mmc_attach(device_t parent, device
 	sc->sc_gpio_cd_inverted = of_hasprop(phandle, "cd-inverted") ? 0 : 1;
 	sc->sc_gpio_wp_inverted = of_hasprop(phandle, "wp-inverted") ? 0 : 1;
 
-	if (sunxi_mmc_idma_setup(sc) != 0) {
+	if (sunxi_mmc_dmabounce_setup(sc) != 0 ||
+	sunxi_mmc_idma_setup(sc) != 0) {
 		aprint_error_dev(self, "failed to setup DMA\n");
 		return;
 	}
@@ -344,6 +350,42 @@ sunxi_mmc_attach(device_t parent, device
 }
 
 static int
+sunxi_mmc_dmabounce_setup(struct sunxi_mmc_softc *sc)
+{
+	bus_dma_segment_t ds[1];
+	int error, rseg;
+
+	sc->sc_dmabounce_buflen = sunxi_mmc_host_maxblklen(sc);
+	error = bus_dmamem_alloc(sc->sc_dmat, sc->sc_dmabounce_buflen, 0,
+	sc->sc_dmabounce_buflen, ds, 1, , BUS_DMA_WAITOK);
+	if (error)
+		return error;
+	error = bus_dmamem_map(sc->sc_dmat, ds, 1, sc->sc_dmabounce_buflen,
+	>sc_dmabounce_buf, BUS_DMA_WAITOK);
+	if (error)
+		goto free;
+	error = bus_dmamap_create(sc->sc_dmat, sc->sc_dmabounce_buflen, 1,
+	sc->sc_dmabounce_buflen, 0, BUS_DMA_WAITOK, >sc_dmabounce_map);
+	if (error)
+		goto unmap;
+	error = bus_dmamap_load(sc->sc_dmat, sc->sc_dmabounce_map,
+	sc->sc_dmabounce_buf, sc->sc_dmabounce_buflen, NULL,
+	BUS_DMA_WAITOK);
+	if (error)
+		goto destroy;
+	return 0;
+
+destroy:
+	bus_dmamap_destroy(sc->sc_dmat, sc->sc_dmabounce_map);
+unmap:
+	bus_dmamem_unmap(sc->sc_dmat, sc->sc_dmabounce_buf,
+	sc->sc_dmabounce_buflen);
+free:
+	bus_dmamem_free(sc->sc_dmat, ds, rseg);
+	return error;
+}
+
+static int
 sunxi_mmc_idma_setup(struct sunxi_mmc_softc *sc)
 {
 	int error;
@@ -798,14 +840,38 @@ sunxi_mmc_dma_prepare(struct sunxi_mmc_s
 {
 	struct sunxi_mmc_idma_descriptor *dma = sc->sc_idma_desc;
 	bus_addr_t desc_paddr = sc->sc_idma_map->dm_segs[0].ds_addr;
+	bus_dmamap_t map;
 	bus_size_t off;
 	int desc, resid, seg;
 	uint32_t val;
 
+	/*
+	 * If the command includes a dma map use it, otherwise we need to
+	 * bounce. This can happen for SDIO IO_RW_EXTENDED (CMD53) commands.
+	 */
+	if (cmd->c_dmamap) {
+		map = cmd->c_dmamap;
+	} else {
+		if (cmd->c_datalen > sc->sc_dmabounce_buflen)
+			return E2BIG;
+		map = sc->sc_dmabounce_map;
+
+		if (!ISSET(cmd->c_flags, SCF_CMD_READ)) {
+			memcpy(sc->sc_dmabounce_buf, cmd->c_data,
+			cmd->c_datalen);
+			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
+			0, cmd->c_datalen, BUS_DMASYNC_PREWRITE);
+		} else {
+			memset(sc->sc_dmabounce_buf, 0, cmd->c_datalen);
+			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
+			0, cmd->c_datalen, BUS_DMASYNC_PREREAD);
+		}
+	}
+
 	desc = 0;
-	for (seg = 0; seg < cmd->c_dmamap->dm_nsegs; seg++) {
-		bus_addr_t paddr = cmd->c_dmamap->dm_segs[seg].ds_addr;
-		bus_size_t len = cmd->c_dmamap->dm_segs[seg].ds_len;
+	for (seg = 0; seg < map->dm_nsegs; seg++) {
+		bus_addr_t paddr = map->dm_segs[seg].ds_addr;
+		bus_size_t len = map->dm_segs[seg].ds_len;
 		resid = min(len, cmd->c_resid);
 		off = 0;
 		while (resid > 0) {
@@ -859,7 +925,7 @@ sunxi_mmc_dma_prepare(struct sunxi_mmc_s
 	SUNXI_MMC_DMAC_IDMA_ON|SUNXI_MMC_DMAC_FIX_BURST);
 	val = MMC_READ(sc, SUNXI_MMC_IDIE);
 	val &= 

CVS commit: src/sys/rump/net/lib/libvirtif

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 13:12:23 UTC 2017

Modified Files:
src/sys/rump/net/lib/libvirtif: if_virt.c

Log Message:
 Fix compile error.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/rump/net/lib/libvirtif/if_virt.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/rump/net/lib/libvirtif/if_virt.c
diff -u src/sys/rump/net/lib/libvirtif/if_virt.c:1.55 src/sys/rump/net/lib/libvirtif/if_virt.c:1.56
--- src/sys/rump/net/lib/libvirtif/if_virt.c:1.55	Mon Oct 23 09:24:34 2017
+++ src/sys/rump/net/lib/libvirtif/if_virt.c	Mon Oct 23 13:12:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_virt.c,v 1.55 2017/10/23 09:24:34 msaitoh Exp $	*/
+/*	$NetBSD: if_virt.c,v 1.56 2017/10/23 13:12:23 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 2008, 2013 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.55 2017/10/23 09:24:34 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_virt.c,v 1.56 2017/10/23 13:12:23 msaitoh Exp $");
 
 #include 
 #include 
@@ -143,13 +143,13 @@ virtif_clone(struct if_clone *ifc, int n
 		goto fail_2;
 	}
 	snprintf(sc->sc_linkstr, LINKSTRNUMLEN, "%d", sc->sc_num);
-#undef LINKSTRNUMLEN
 	error = virtif_create(ifp);
 	if (error) {
 fail_2:
 		if_detach(ifp);
 		if (sc->sc_linkstr != NULL)
 			kmem_free(sc->sc_linkstr, LINKSTRNUMLEN);
+#undef LINKSTRNUMLEN
 fail_1:
 		kmem_free(sc, sizeof(*sc));
 		ifp->if_softc = NULL;



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

2017-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 23 13:28:19 UTC 2017

Modified Files:
src/sys/arch/arm/sunxi: sunxi_mmc.c

Log Message:
Fix swapped BUS_DMASYNC_POST{READ,WRITE} on bounced commands


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/arm/sunxi/sunxi_mmc.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/sunxi/sunxi_mmc.c
diff -u src/sys/arch/arm/sunxi/sunxi_mmc.c:1.14 src/sys/arch/arm/sunxi/sunxi_mmc.c:1.15
--- src/sys/arch/arm/sunxi/sunxi_mmc.c:1.14	Mon Oct 23 13:11:17 2017
+++ src/sys/arch/arm/sunxi/sunxi_mmc.c	Mon Oct 23 13:28:19 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mmc.c,v 1.14 2017/10/23 13:11:17 jmcneill Exp $ */
+/* $NetBSD: sunxi_mmc.c,v 1.15 2017/10/23 13:28:19 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2014-2017 Jared McNeill 
@@ -29,7 +29,7 @@
 #include "opt_sunximmc.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.14 2017/10/23 13:11:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mmc.c,v 1.15 2017/10/23 13:28:19 jmcneill Exp $");
 
 #include 
 #include 
@@ -856,15 +856,15 @@ sunxi_mmc_dma_prepare(struct sunxi_mmc_s
 			return E2BIG;
 		map = sc->sc_dmabounce_map;
 
-		if (!ISSET(cmd->c_flags, SCF_CMD_READ)) {
+		if (ISSET(cmd->c_flags, SCF_CMD_READ)) {
+			memset(sc->sc_dmabounce_buf, 0, cmd->c_datalen);
+			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
+			0, cmd->c_datalen, BUS_DMASYNC_PREREAD);
+		} else {
 			memcpy(sc->sc_dmabounce_buf, cmd->c_data,
 			cmd->c_datalen);
 			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
 			0, cmd->c_datalen, BUS_DMASYNC_PREWRITE);
-		} else {
-			memset(sc->sc_dmabounce_buf, 0, cmd->c_datalen);
-			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
-			0, cmd->c_datalen, BUS_DMASYNC_PREREAD);
 		}
 	}
 
@@ -945,12 +945,12 @@ sunxi_mmc_dma_complete(struct sunxi_mmc_
 	if (cmd->c_dmamap == NULL) {
 		if (ISSET(cmd->c_flags, SCF_CMD_READ)) {
 			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
-			0, cmd->c_datalen, BUS_DMASYNC_POSTWRITE);
+			0, cmd->c_datalen, BUS_DMASYNC_POSTREAD);
 			memcpy(cmd->c_data, sc->sc_dmabounce_buf,
 			cmd->c_datalen);
 		} else {
 			bus_dmamap_sync(sc->sc_dmat, sc->sc_dmabounce_map,
-			0, cmd->c_datalen, BUS_DMASYNC_POSTREAD);
+			0, cmd->c_datalen, BUS_DMASYNC_POSTWRITE);
 		}
 	}
 }



CVS commit: src/sys/dev/sdmmc

2017-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 23 13:47:17 UTC 2017

Modified Files:
src/sys/dev/sdmmc: sdmmc_io.c

Log Message:
- Get SDIO reset working (from OpenBSD).
- After switching bus width, notify the host controller of the change.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/sdmmc/sdmmc_io.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/sdmmc/sdmmc_io.c
diff -u src/sys/dev/sdmmc/sdmmc_io.c:1.12 src/sys/dev/sdmmc/sdmmc_io.c:1.13
--- src/sys/dev/sdmmc/sdmmc_io.c:1.12	Tue Oct  6 14:32:51 2015
+++ src/sys/dev/sdmmc/sdmmc_io.c	Mon Oct 23 13:47:17 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sdmmc_io.c,v 1.12 2015/10/06 14:32:51 mlelstv Exp $	*/
+/*	$NetBSD: sdmmc_io.c,v 1.13 2017/10/23 13:47:17 jmcneill Exp $	*/
 /*	$OpenBSD: sdmmc_io.c,v 1.10 2007/09/17 01:33:33 krw Exp $	*/
 
 /*
@@ -20,7 +20,7 @@
 /* Routines for SD I/O cards. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.12 2015/10/06 14:32:51 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sdmmc_io.c,v 1.13 2017/10/23 13:47:17 jmcneill Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_sdmmc.h"
@@ -122,9 +122,6 @@ sdmmc_io_enable(struct sdmmc_softc *sc)
 		goto out;
 	}
 
-	/* Reset I/O functions (again). */
-	sdmmc_io_reset(sc);
-
 	/* Send the new OCR value until all cards are ready. */
 	error = sdmmc_io_send_op_cond(sc, host_ocr, NULL);
 	if (error) {
@@ -203,6 +200,11 @@ sdmmc_io_init(struct sdmmc_softc *sc, st
 			sdmmc_io_write_1(sf, SD_IO_CCCR_BUS_WIDTH,
 			CCCR_BUS_WIDTH_4);
 			sf->width = 4;
+			error = sdmmc_chip_bus_width(sc->sc_sct, sc->sc_sch,
+			sf->width);
+			if (error)
+aprint_error_dev(sc->sc_dev,
+"can't change bus width\n");
 		}
 
 		error = sdmmc_read_cis(sf, >cis);
@@ -535,12 +537,10 @@ sdmmc_io_xchg(struct sdmmc_softc *sc, st
 static void
 sdmmc_io_reset(struct sdmmc_softc *sc)
 {
+	u_char data = CCCR_CTL_RES;
 
-	/* Don't lock */
-#if 0 /* XXX command fails */
-	(void)sdmmc_io_write(sc, NULL, SD_IO_REG_CCCR_CTL, CCCR_CTL_RES);
-	sdmmc_delay(10);
-#endif
+	if (sdmmc_io_rw_direct(sc, NULL, SD_IO_CCCR_CTL, , SD_ARG_CMD52_WRITE) == 0)
+		sdmmc_delay(10);
 }
 
 /*



CVS commit: [netbsd-7] src/usr.sbin/syslogd

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:52:08 UTC 2017

Modified Files:
src/usr.sbin/syslogd [netbsd-7]: syslogd.c

Log Message:
Pull up following revision(s) (requested by ginsbach in ticket #1510):
usr.sbin/syslogd/syslogd.c: revision 1.124
Use looked up remote host for remote message without a hostname
An incoming remote message may not necessarily have a hostname
between the timestamp and the message. The the source of the remote
sender is already looked up so use that hostname/IP address rather
than the local hostname.


To generate a diff of this commit:
cvs rdiff -u -r1.119.4.2 -r1.119.4.3 src/usr.sbin/syslogd/syslogd.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/syslogd/syslogd.c
diff -u src/usr.sbin/syslogd/syslogd.c:1.119.4.2 src/usr.sbin/syslogd/syslogd.c:1.119.4.3
--- src/usr.sbin/syslogd/syslogd.c:1.119.4.2	Mon Sep  4 06:30:38 2017
+++ src/usr.sbin/syslogd/syslogd.c	Mon Oct 23 18:52:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: syslogd.c,v 1.119.4.2 2017/09/04 06:30:38 snj Exp $	*/
+/*	$NetBSD: syslogd.c,v 1.119.4.3 2017/10/23 18:52:08 snj Exp $	*/
 
 /*
  * Copyright (c) 1983, 1988, 1993, 1994
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)syslogd.c	8.3 (Berkeley) 4/4/94";
 #else
-__RCSID("$NetBSD: syslogd.c,v 1.119.4.2 2017/09/04 06:30:38 snj Exp $");
+__RCSID("$NetBSD: syslogd.c,v 1.119.4.3 2017/10/23 18:52:08 snj Exp $");
 #endif
 #endif /* not lint */
 
@@ -1279,7 +1279,7 @@ printline_bsdsyslog(const char *hname, c
 		} else if (*p == '[' || (*p == ':'
 			&& (*(p+1) == ' ' || *(p+1) == '\0'))) {
 			/* no host in message */
-			buffer->host = LocalFQDN;
+			buffer->host = strdup(hname);
 			buffer->prog = strndup(start, p - start);
 			break;
 		} else {



CVS commit: [netbsd-7] src/share/man/man8

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:03:34 UTC 2017

Modified Files:
src/share/man/man8 [netbsd-7]: veriexec.8

Log Message:
Pull up following revision(s) (requested by sevan in ticket #1513):
share/man/man8/veriexec.8: 1.5-1.6
The bogus number police
--
Add missing VERIFIED_EXEC_FP_SHA384 option.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.4.1 src/share/man/man8/veriexec.8

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

Modified files:

Index: src/share/man/man8/veriexec.8
diff -u src/share/man/man8/veriexec.8:1.4 src/share/man/man8/veriexec.8:1.4.4.1
--- src/share/man/man8/veriexec.8:1.4	Tue Mar 18 18:20:40 2014
+++ src/share/man/man8/veriexec.8	Mon Oct 23 19:03:34 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: veriexec.8,v 1.4 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: veriexec.8,v 1.4.4.1 2017/10/23 19:03:34 snj Exp $
 .\"
 .\" Copyright (c) 2008 Elad Efrat 
 .\" All rights reserved.
@@ -25,7 +25,7 @@
 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd February 18, 2008
+.Dd September 13, 2017
 .Dt VERIEXEC 8
 .Os
 .Sh NAME
@@ -67,12 +67,13 @@ below), this list can be loaded manually
 .Em Veriexec
 requires a pseudo-device to run:
 .Bd -literal -offset indent
-pseudo-device veriexec 1
+pseudo-device veriexec
 .Ed
 .Pp
 Additionally, one or more options for digital fingerprint algorithm support:
 .Bd -literal -offset indent
 options VERIFIED_EXEC_FP_SHA256
+options VERIFIED_EXEC_FP_SHA384
 options VERIFIED_EXEC_FP_SHA512
 .Ed
 .Pp



CVS commit: [netbsd-7] src/sys/dev/usb

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:15:09 UTC 2017

Modified Files:
src/sys/dev/usb [netbsd-7]: if_athn_usb.c

Log Message:
Pull up following revision(s) (requested by skrll in ticket #1515):
sys/dev/usb/if_athn_usb.c: revision 1.23
PR/52553 Panic on "ifconfig athn0 up"
Don't race for a transfer in athn_usb_init on the free list for beacons.
Instead pre-assign a transfer to beacons in athn_usb_alloc_tx_list


To generate a diff of this commit:
cvs rdiff -u -r1.6.6.1 -r1.6.6.2 src/sys/dev/usb/if_athn_usb.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/if_athn_usb.c
diff -u src/sys/dev/usb/if_athn_usb.c:1.6.6.1 src/sys/dev/usb/if_athn_usb.c:1.6.6.2
--- src/sys/dev/usb/if_athn_usb.c:1.6.6.1	Wed Apr  5 19:54:19 2017
+++ src/sys/dev/usb/if_athn_usb.c	Mon Oct 23 19:15:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_athn_usb.c,v 1.6.6.1 2017/04/05 19:54:19 snj Exp $	*/
+/*	$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $	*/
 /*	$OpenBSD: if_athn_usb.c,v 1.12 2013/01/14 09:50:31 jsing Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.1 2017/04/05 19:54:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_athn_usb.c,v 1.6.6.2 2017/10/23 19:15:09 snj Exp $");
 
 #ifdef	_KERNEL_OPT
 #include "opt_inet.h"
@@ -733,9 +733,15 @@ athn_usb_alloc_tx_list(struct athn_usb_s
 		/* Append this Tx buffer to our free list. */
 		TAILQ_INSERT_TAIL(>usc_tx_free_list, data, next);
 	}
-	if (error != 0)
+	if (error == 0) {
+		/* Steal one buffer for beacons. */
+		usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list);
+		TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next);
+	} else {
 		athn_usb_free_tx_list(usc);
+	}
 	mutex_exit(>usc_tx_mtx);
+
 	return error;
 }
 
@@ -754,6 +760,10 @@ athn_usb_free_tx_list(struct athn_usb_so
 		if (xfer != NULL)
 			usbd_destroy_xfer(xfer);
 	}
+	if (usc->usc_tx_bcn) {
+		usbd_destroy_xfer(usc->usc_tx_bcn->xfer);
+		usc->usc_tx_bcn = NULL;
+	}
 }
 
 Static int
@@ -2761,12 +2771,6 @@ athn_usb_init_locked(struct ifnet *ifp)
 	usc->usc_cmdq.cur = usc->usc_cmdq.next = usc->usc_cmdq.queued = 0;
 	mutex_spin_exit(>usc_task_mtx);
 
-	/* Steal one buffer for beacons. */
-	mutex_enter(>usc_tx_mtx);
-	usc->usc_tx_bcn = TAILQ_FIRST(>usc_tx_free_list);
-	TAILQ_REMOVE(>usc_tx_free_list, usc->usc_tx_bcn, next);
-	mutex_exit(>usc_tx_mtx);
-
 	curchan = ic->ic_curchan;
 	extchan = NULL;
 



CVS commit: [netbsd-7] src/sbin/resize_ffs

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:24:37 UTC 2017

Modified Files:
src/sbin/resize_ffs [netbsd-7]: resize_ffs.8 resize_ffs.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1516):
sbin/resize_ffs/resize_ffs.8: revision 1.18
sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.


To generate a diff of this commit:
cvs rdiff -u -r1.13.20.1 -r1.13.20.2 src/sbin/resize_ffs/resize_ffs.8
cvs rdiff -u -r1.38.6.2 -r1.38.6.3 src/sbin/resize_ffs/resize_ffs.c

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

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.8
diff -u src/sbin/resize_ffs/resize_ffs.8:1.13.20.1 src/sbin/resize_ffs/resize_ffs.8:1.13.20.2
--- src/sbin/resize_ffs/resize_ffs.8:1.13.20.1	Thu Aug  6 21:13:44 2015
+++ src/sbin/resize_ffs/resize_ffs.8	Mon Oct 23 19:24:36 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: resize_ffs.8,v 1.13.20.1 2015/08/06 21:13:44 snj Exp $
+.\" $NetBSD: resize_ffs.8,v 1.13.20.2 2017/10/23 19:24:36 snj Exp $
 .\"
 .\" As its sole author, I explicitly place this man page in the public
 .\" domain.  Anyone may use it in any way for any purpose (though I would
@@ -9,7 +9,7 @@
 .\"  X  Against HTML   mo...@rodents.montreal.qc.ca
 .\" / \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
 .\"
-.Dd April 6, 2015
+.Dd October 1, 2017
 .Dt RESIZE_FFS 8
 .Os
 .Sh NAME
@@ -128,10 +128,8 @@ command first appeared in
 .Aq r...@netbsd.org
 (Byteswapped file system and UFS2 support)
 .Pp
-A big bug-finding kudos goes to John Kohl for finding the rotational
-layout bug referred to in the
-.Sx WARNING
-section above.
+A big bug-finding kudos goes to John Kohl for finding a significant
+rotational layout bug.
 .Sh BUGS
 Can fail to shrink a file system when there actually is enough space,
 because it does not distinguish between a block allocated as a block

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.38.6.2 src/sbin/resize_ffs/resize_ffs.c:1.38.6.3
--- src/sbin/resize_ffs/resize_ffs.c:1.38.6.2	Sat Sep 10 06:36:37 2016
+++ src/sbin/resize_ffs/resize_ffs.c	Mon Oct 23 19:24:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.38.6.2 2016/09/10 06:36:37 snj Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.38.6.3 2017/10/23 19:24:37 snj Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: resize_ffs.c,v 1.38.6.2 2016/09/10 06:36:37 snj Exp $");
+__RCSID("$NetBSD: resize_ffs.c,v 1.38.6.3 2017/10/23 19:24:37 snj Exp $");
 
 #include 
 #include 
@@ -462,10 +462,10 @@ static void
 initcg(int cgn)
 {
 	struct cg *cg;		/* The in-core cg, of course */
-	int base;		/* Disk address of cg base */
-	int dlow;		/* Size of pre-cg data area */
-	int dhigh;		/* Offset of post-inode data area, from base */
-	int dmax;		/* Offset of end of post-inode data area */
+	int64_t base;		/* Disk address of cg base */
+	int64_t dlow;		/* Size of pre-cg data area */
+	int64_t dhigh;		/* Offset of post-inode data area, from base */
+	int64_t dmax;		/* Offset of end of post-inode data area */
 	int i;			/* Generic loop index */
 	int n;			/* Generic count */
 	int start;		/* start of cg maps */
@@ -478,7 +478,7 @@ initcg(int cgn)
 	dmax = newsb->fs_size - base;
 	if (dmax > newsb->fs_fpg)
 		dmax = newsb->fs_fpg;
-	start = >cg_space[0] - (unsigned char *) cg;
+	start = (unsigned char *)>cg_space[0] - (unsigned char *) cg;
 	/*
  * Clear out the cg - assumes all-0-bytes is the correct way
  * to initialize fields we don't otherwise touch, which is
@@ -564,13 +564,16 @@ initcg(int cgn)
 	 * below for the post-inode data area, is that the pre-sb data
 	 * area always starts at 0, and thus is block-aligned, and
 	 * always ends at the sb, which is block-aligned.) */
-	if ((newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0)
-		for (i = 0; i < dlow; i += newsb->fs_frag) {
-			old_cg_blktot(cg, 0)[old_cbtocylno(newsb, i)]++;
+	if ((newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0) {
+		int64_t di;
+
+		for (di = 0; di < dlow; di += newsb->fs_frag) {
+			old_cg_blktot(cg, 0)[old_cbtocylno(newsb, di)]++;
 			old_cg_blks(newsb, cg,
-			old_cbtocylno(newsb, i),
-			0)[old_cbtorpos(newsb, i)]++;
+			old_cbtocylno(newsb, di),
+			0)[old_cbtorpos(newsb, di)]++;
 		}
+	}
 
 	/* Deal with a partial block at 

CVS commit: [netbsd-7-0] src/sbin/resize_ffs

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:24:33 UTC 2017

Modified Files:
src/sbin/resize_ffs [netbsd-7-0]: resize_ffs.8 resize_ffs.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1516):
sbin/resize_ffs/resize_ffs.8: revision 1.18
sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.


To generate a diff of this commit:
cvs rdiff -u -r1.13.20.1 -r1.13.20.1.2.1 src/sbin/resize_ffs/resize_ffs.8
cvs rdiff -u -r1.38.6.1 -r1.38.6.1.2.1 src/sbin/resize_ffs/resize_ffs.c

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

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.8
diff -u src/sbin/resize_ffs/resize_ffs.8:1.13.20.1 src/sbin/resize_ffs/resize_ffs.8:1.13.20.1.2.1
--- src/sbin/resize_ffs/resize_ffs.8:1.13.20.1	Thu Aug  6 21:13:44 2015
+++ src/sbin/resize_ffs/resize_ffs.8	Mon Oct 23 19:24:33 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: resize_ffs.8,v 1.13.20.1 2015/08/06 21:13:44 snj Exp $
+.\" $NetBSD: resize_ffs.8,v 1.13.20.1.2.1 2017/10/23 19:24:33 snj Exp $
 .\"
 .\" As its sole author, I explicitly place this man page in the public
 .\" domain.  Anyone may use it in any way for any purpose (though I would
@@ -9,7 +9,7 @@
 .\"  X  Against HTML   mo...@rodents.montreal.qc.ca
 .\" / \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
 .\"
-.Dd April 6, 2015
+.Dd October 1, 2017
 .Dt RESIZE_FFS 8
 .Os
 .Sh NAME
@@ -128,10 +128,8 @@ command first appeared in
 .Aq r...@netbsd.org
 (Byteswapped file system and UFS2 support)
 .Pp
-A big bug-finding kudos goes to John Kohl for finding the rotational
-layout bug referred to in the
-.Sx WARNING
-section above.
+A big bug-finding kudos goes to John Kohl for finding a significant
+rotational layout bug.
 .Sh BUGS
 Can fail to shrink a file system when there actually is enough space,
 because it does not distinguish between a block allocated as a block

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.38.6.1 src/sbin/resize_ffs/resize_ffs.c:1.38.6.1.2.1
--- src/sbin/resize_ffs/resize_ffs.c:1.38.6.1	Thu Aug  6 21:13:44 2015
+++ src/sbin/resize_ffs/resize_ffs.c	Mon Oct 23 19:24:33 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.38.6.1 2015/08/06 21:13:44 snj Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.38.6.1.2.1 2017/10/23 19:24:33 snj Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: resize_ffs.c,v 1.38.6.1 2015/08/06 21:13:44 snj Exp $");
+__RCSID("$NetBSD: resize_ffs.c,v 1.38.6.1.2.1 2017/10/23 19:24:33 snj Exp $");
 
 #include 
 #include 
@@ -461,10 +461,10 @@ static void
 initcg(int cgn)
 {
 	struct cg *cg;		/* The in-core cg, of course */
-	int base;		/* Disk address of cg base */
-	int dlow;		/* Size of pre-cg data area */
-	int dhigh;		/* Offset of post-inode data area, from base */
-	int dmax;		/* Offset of end of post-inode data area */
+	int64_t base;		/* Disk address of cg base */
+	int64_t dlow;		/* Size of pre-cg data area */
+	int64_t dhigh;		/* Offset of post-inode data area, from base */
+	int64_t dmax;		/* Offset of end of post-inode data area */
 	int i;			/* Generic loop index */
 	int n;			/* Generic count */
 	int start;		/* start of cg maps */
@@ -477,7 +477,7 @@ initcg(int cgn)
 	dmax = newsb->fs_size - base;
 	if (dmax > newsb->fs_fpg)
 		dmax = newsb->fs_fpg;
-	start = >cg_space[0] - (unsigned char *) cg;
+	start = (unsigned char *)>cg_space[0] - (unsigned char *) cg;
 	/*
  * Clear out the cg - assumes all-0-bytes is the correct way
  * to initialize fields we don't otherwise touch, which is
@@ -563,13 +563,16 @@ initcg(int cgn)
 	 * below for the post-inode data area, is that the pre-sb data
 	 * area always starts at 0, and thus is block-aligned, and
 	 * always ends at the sb, which is block-aligned.) */
-	if ((newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0)
-		for (i = 0; i < dlow; i += newsb->fs_frag) {
-			old_cg_blktot(cg, 0)[old_cbtocylno(newsb, i)]++;
+	if ((newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0) {
+		int64_t di;
+
+		for (di = 0; di < dlow; di += newsb->fs_frag) {
+			old_cg_blktot(cg, 0)[old_cbtocylno(newsb, di)]++;
 			old_cg_blks(newsb, cg,
-			old_cbtocylno(newsb, i),
-			0)[old_cbtorpos(newsb, i)]++;
+			old_cbtocylno(newsb, di),
+			0)[old_cbtorpos(newsb, di)]++;
 		}
+	}
 
 	/* 

CVS commit: [netbsd-7-0] src/usr.sbin/mtree

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:34:51 UTC 2017

Modified Files:
src/usr.sbin/mtree [netbsd-7-0]: only.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1506):
usr.sbin/mtree/only.c: revision 1.3
Don't modify strings stored in hash, otherwise filling up of
directory hierarchy stops if the same hash value occurs in
directory and leaf.
Fix the issue that
"./usr/share/locale/pl/LC_MESSAGES/gettext-tools.mo" isn't included
in sets file in the case of MKUNPRIVED=no.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.14.1 src/usr.sbin/mtree/only.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/mtree/only.c
diff -u src/usr.sbin/mtree/only.c:1.2 src/usr.sbin/mtree/only.c:1.2.14.1
--- src/usr.sbin/mtree/only.c:1.2	Tue Feb  5 00:59:03 2013
+++ src/usr.sbin/mtree/only.c	Mon Oct 23 18:34:50 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $	*/
+/*	$NetBSD: only.c,v 1.2.14.1 2017/10/23 18:34:50 snj Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $");
+__RCSID("$NetBSD: only.c,v 1.2.14.1 2017/10/23 18:34:50 snj Exp $");
 #endif
 
 #include 
@@ -89,11 +89,14 @@ static void
 hash_insert(char *str, uint32_t h)
 {
 	struct hentry *e;
+	char *x;
 
 	if ((e = malloc(sizeof(*e))) == NULL)
 		mtree_err("memory allocation error");
+	if ((x = strdup(str)) == NULL)
+		mtree_err("memory allocation error");
 
-	e->str = str;
+	e->str = x;
 	e->hash = h;
 	e->next = table[h];
 	table[h] = e;
@@ -110,10 +113,7 @@ fill(char *str)
 
 	*ptr = '\0';
 	if (!hash_find(str, )) {
-		char *x = strdup(str);
-		if (x == NULL)
-			mtree_err("memory allocation error");
-		hash_insert(x, h);
+		hash_insert(str, h);
 		fill(str);
 	}
 	*ptr = '/';
@@ -135,6 +135,7 @@ load_only(const char *fname)
 			err(1, "Duplicate entry %s", line);
 		hash_insert(line, h);
 		fill(line);
+		free(line);
 	}
 
 	fclose(fp);



CVS commit: [netbsd-7-0] src/sys/dev

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:27:41 UTC 2017

Modified Files:
src/sys/dev [netbsd-7-0]: cgd.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #1518):
sys/dev/cgd.c: revision 1.113
PR kern/52630: The cgd(4) module requires des and blowfish symbols
This has been exposed with the MODULAR kernel.
kobj_checksyms, 979: [cgd]: linker error: symbol `BF_set_key' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_key_sched' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_ede3_cbc_encrypt' not 
found
WARNING: module error: unable to affix module `cgd', error 8
Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.90.4.2 -r1.90.4.3 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.90.4.2 src/sys/dev/cgd.c:1.90.4.3
--- src/sys/dev/cgd.c:1.90.4.2	Sat Jul  8 16:12:44 2017
+++ src/sys/dev/cgd.c	Mon Oct 23 19:27:41 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.90.4.2 2017/07/08 16:12:44 snj Exp $ */
+/* $NetBSD: cgd.c,v 1.90.4.3 2017/10/23 19:27:41 snj Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.4.2 2017/07/08 16:12:44 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.4.3 2017/10/23 19:27:41 snj Exp $");
 
 #include 
 #include 
@@ -998,7 +998,7 @@ hexprint(const char *start, void *buf, i
 }
 #endif
 
-MODULE(MODULE_CLASS_DRIVER, cgd, "dk_subr");
+MODULE(MODULE_CLASS_DRIVER, cgd, "blowfish,des,dk_subr");
 
 #ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);



CVS commit: [netbsd-7] src/sys/dev

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:27:45 UTC 2017

Modified Files:
src/sys/dev [netbsd-7]: cgd.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #1518):
sys/dev/cgd.c: revision 1.113
PR kern/52630: The cgd(4) module requires des and blowfish symbols
This has been exposed with the MODULAR kernel.
kobj_checksyms, 979: [cgd]: linker error: symbol `BF_set_key' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_key_sched' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_ede3_cbc_encrypt' not 
found
WARNING: module error: unable to affix module `cgd', error 8
Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.90.2.2 -r1.90.2.3 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.90.2.2 src/sys/dev/cgd.c:1.90.2.3
--- src/sys/dev/cgd.c:1.90.2.2	Sat Jul  8 16:14:19 2017
+++ src/sys/dev/cgd.c	Mon Oct 23 19:27:44 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.90.2.2 2017/07/08 16:14:19 snj Exp $ */
+/* $NetBSD: cgd.c,v 1.90.2.3 2017/10/23 19:27:44 snj Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.2 2017/07/08 16:14:19 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.3 2017/10/23 19:27:44 snj Exp $");
 
 #include 
 #include 
@@ -998,7 +998,7 @@ hexprint(const char *start, void *buf, i
 }
 #endif
 
-MODULE(MODULE_CLASS_DRIVER, cgd, "dk_subr");
+MODULE(MODULE_CLASS_DRIVER, cgd, "blowfish,des,dk_subr");
 
 #ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);



CVS commit: [netbsd-7-1] src/sys/dev

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:27:43 UTC 2017

Modified Files:
src/sys/dev [netbsd-7-1]: cgd.c

Log Message:
Pull up following revision(s) (requested by kamil in ticket #1518):
sys/dev/cgd.c: revision 1.113
PR kern/52630: The cgd(4) module requires des and blowfish symbols
This has been exposed with the MODULAR kernel.
kobj_checksyms, 979: [cgd]: linker error: symbol `BF_set_key' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_key_sched' not found
kobj_checksyms, 979: [cgd]: linker error: symbol `des_ede3_cbc_encrypt' not 
found
WARNING: module error: unable to affix module `cgd', error 8
Reviewed by 


To generate a diff of this commit:
cvs rdiff -u -r1.90.2.1.4.1 -r1.90.2.1.4.2 src/sys/dev/cgd.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/cgd.c
diff -u src/sys/dev/cgd.c:1.90.2.1.4.1 src/sys/dev/cgd.c:1.90.2.1.4.2
--- src/sys/dev/cgd.c:1.90.2.1.4.1	Sat Jul  8 16:13:55 2017
+++ src/sys/dev/cgd.c	Mon Oct 23 19:27:43 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: cgd.c,v 1.90.2.1.4.1 2017/07/08 16:13:55 snj Exp $ */
+/* $NetBSD: cgd.c,v 1.90.2.1.4.2 2017/10/23 19:27:43 snj Exp $ */
 
 /*-
  * Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.1.4.1 2017/07/08 16:13:55 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cgd.c,v 1.90.2.1.4.2 2017/10/23 19:27:43 snj Exp $");
 
 #include 
 #include 
@@ -998,7 +998,7 @@ hexprint(const char *start, void *buf, i
 }
 #endif
 
-MODULE(MODULE_CLASS_DRIVER, cgd, "dk_subr");
+MODULE(MODULE_CLASS_DRIVER, cgd, "blowfish,des,dk_subr");
 
 #ifdef _MODULE
 CFDRIVER_DECL(cgd, DV_DISK, NULL);



CVS commit: src/sys/kern

2017-10-23 Thread Jaromir Dolecek
Module Name:src
Committed By:   jdolecek
Date:   Mon Oct 23 19:03:40 UTC 2017

Modified Files:
src/sys/kern: vfs_wapbl.c

Log Message:
remove counter for 'journal I/O bufs biowait' - it's (total - async), so
superfluous; adjust the description of the the other counters a bit to make
them more clear


To generate a diff of this commit:
cvs rdiff -u -r1.97 -r1.98 src/sys/kern/vfs_wapbl.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/kern/vfs_wapbl.c
diff -u src/sys/kern/vfs_wapbl.c:1.97 src/sys/kern/vfs_wapbl.c:1.98
--- src/sys/kern/vfs_wapbl.c:1.97	Thu Jun  8 01:23:01 2017
+++ src/sys/kern/vfs_wapbl.c	Mon Oct 23 19:03:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_wapbl.c,v 1.97 2017/06/08 01:23:01 chs Exp $	*/
+/*	$NetBSD: vfs_wapbl.c,v 1.98 2017/10/23 19:03:40 jdolecek Exp $	*/
 
 /*-
  * Copyright (c) 2003, 2008, 2009 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
 #define WAPBL_INTERNAL
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.97 2017/06/08 01:23:01 chs Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_wapbl.c,v 1.98 2017/10/23 19:03:40 jdolecek Exp $");
 
 #include 
 #include 
@@ -193,7 +193,6 @@ struct wapbl {
 	struct evcnt wl_ev_commit;		/* l	*/
 	struct evcnt wl_ev_journalwrite;	/* l	*/
 	struct evcnt wl_ev_jbufs_bio_nowait;	/* l	*/
-	struct evcnt wl_ev_jbufs_bio_wait;	/* l	*/
 	struct evcnt wl_ev_metawrite;		/* lm	*/
 	struct evcnt wl_ev_cacheflush;		/* l	*/
 #endif
@@ -412,13 +411,11 @@ wapbl_evcnt_init(struct wapbl *wl)
 	evcnt_attach_dynamic(>wl_ev_commit, EVCNT_TYPE_MISC,
 	NULL, wl->wl_ev_group, "commit");
 	evcnt_attach_dynamic(>wl_ev_journalwrite, EVCNT_TYPE_MISC,
-	NULL, wl->wl_ev_group, "journal sync block write");
+	NULL, wl->wl_ev_group, "journal write total");
 	evcnt_attach_dynamic(>wl_ev_jbufs_bio_nowait, EVCNT_TYPE_MISC,
-	NULL, wl->wl_ev_group, "journal I/O bufs no wait");
-	evcnt_attach_dynamic(>wl_ev_jbufs_bio_wait, EVCNT_TYPE_MISC,
-	NULL, wl->wl_ev_group, "journal I/O bufs biowait");
+	NULL, wl->wl_ev_group, "journal write finished async");
 	evcnt_attach_dynamic(>wl_ev_metawrite, EVCNT_TYPE_MISC,
-	NULL, wl->wl_ev_group, "metadata finished block write");
+	NULL, wl->wl_ev_group, "metadata async write");
 	evcnt_attach_dynamic(>wl_ev_cacheflush, EVCNT_TYPE_MISC,
 	NULL, wl->wl_ev_group, "cache flush");
 }
@@ -429,7 +426,6 @@ wapbl_evcnt_free(struct wapbl *wl)
 	evcnt_detach(>wl_ev_commit);
 	evcnt_detach(>wl_ev_journalwrite);
 	evcnt_detach(>wl_ev_jbufs_bio_nowait);
-	evcnt_detach(>wl_ev_jbufs_bio_wait);
 	evcnt_detach(>wl_ev_metawrite);
 	evcnt_detach(>wl_ev_cacheflush);
 }
@@ -1042,8 +1038,6 @@ again:
 			
 		if (ISSET(bp->b_oflags, BO_DONE))
 			wl->wl_ev_jbufs_bio_nowait.ev_count++;
-		else
-			wl->wl_ev_jbufs_bio_wait.ev_count++;
 
 		TAILQ_REMOVE(>wl_iobufs_busy, bp, b_wapbllist);
 		error = biowait(bp);



CVS commit: [netbsd-7] src/usr.sbin/mtree

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:34:53 UTC 2017

Modified Files:
src/usr.sbin/mtree [netbsd-7]: only.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1506):
usr.sbin/mtree/only.c: revision 1.3
Don't modify strings stored in hash, otherwise filling up of
directory hierarchy stops if the same hash value occurs in
directory and leaf.
Fix the issue that
"./usr/share/locale/pl/LC_MESSAGES/gettext-tools.mo" isn't included
in sets file in the case of MKUNPRIVED=no.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.12.1 src/usr.sbin/mtree/only.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/mtree/only.c
diff -u src/usr.sbin/mtree/only.c:1.2 src/usr.sbin/mtree/only.c:1.2.12.1
--- src/usr.sbin/mtree/only.c:1.2	Tue Feb  5 00:59:03 2013
+++ src/usr.sbin/mtree/only.c	Mon Oct 23 18:34:53 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $	*/
+/*	$NetBSD: only.c,v 1.2.12.1 2017/10/23 18:34:53 snj Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $");
+__RCSID("$NetBSD: only.c,v 1.2.12.1 2017/10/23 18:34:53 snj Exp $");
 #endif
 
 #include 
@@ -89,11 +89,14 @@ static void
 hash_insert(char *str, uint32_t h)
 {
 	struct hentry *e;
+	char *x;
 
 	if ((e = malloc(sizeof(*e))) == NULL)
 		mtree_err("memory allocation error");
+	if ((x = strdup(str)) == NULL)
+		mtree_err("memory allocation error");
 
-	e->str = str;
+	e->str = x;
 	e->hash = h;
 	e->next = table[h];
 	table[h] = e;
@@ -110,10 +113,7 @@ fill(char *str)
 
 	*ptr = '\0';
 	if (!hash_find(str, )) {
-		char *x = strdup(str);
-		if (x == NULL)
-			mtree_err("memory allocation error");
-		hash_insert(x, h);
+		hash_insert(str, h);
 		fill(str);
 	}
 	*ptr = '/';
@@ -135,6 +135,7 @@ load_only(const char *fname)
 			err(1, "Duplicate entry %s", line);
 		hash_insert(line, h);
 		fill(line);
+		free(line);
 	}
 
 	fclose(fp);



CVS commit: [netbsd-7-1] src/usr.sbin/mtree

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:34:52 UTC 2017

Modified Files:
src/usr.sbin/mtree [netbsd-7-1]: only.c

Log Message:
Pull up following revision(s) (requested by nakayama in ticket #1506):
usr.sbin/mtree/only.c: revision 1.3
Don't modify strings stored in hash, otherwise filling up of
directory hierarchy stops if the same hash value occurs in
directory and leaf.
Fix the issue that
"./usr/share/locale/pl/LC_MESSAGES/gettext-tools.mo" isn't included
in sets file in the case of MKUNPRIVED=no.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.2.22.1 src/usr.sbin/mtree/only.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/mtree/only.c
diff -u src/usr.sbin/mtree/only.c:1.2 src/usr.sbin/mtree/only.c:1.2.22.1
--- src/usr.sbin/mtree/only.c:1.2	Tue Feb  5 00:59:03 2013
+++ src/usr.sbin/mtree/only.c	Mon Oct 23 18:34:52 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $	*/
+/*	$NetBSD: only.c,v 1.2.22.1 2017/10/23 18:34:52 snj Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 #include 
 
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: only.c,v 1.2 2013/02/05 00:59:03 christos Exp $");
+__RCSID("$NetBSD: only.c,v 1.2.22.1 2017/10/23 18:34:52 snj Exp $");
 #endif
 
 #include 
@@ -89,11 +89,14 @@ static void
 hash_insert(char *str, uint32_t h)
 {
 	struct hentry *e;
+	char *x;
 
 	if ((e = malloc(sizeof(*e))) == NULL)
 		mtree_err("memory allocation error");
+	if ((x = strdup(str)) == NULL)
+		mtree_err("memory allocation error");
 
-	e->str = str;
+	e->str = x;
 	e->hash = h;
 	e->next = table[h];
 	table[h] = e;
@@ -110,10 +113,7 @@ fill(char *str)
 
 	*ptr = '\0';
 	if (!hash_find(str, )) {
-		char *x = strdup(str);
-		if (x == NULL)
-			mtree_err("memory allocation error");
-		hash_insert(x, h);
+		hash_insert(str, h);
 		fill(str);
 	}
 	*ptr = '/';
@@ -135,6 +135,7 @@ load_only(const char *fname)
 			err(1, "Duplicate entry %s", line);
 		hash_insert(line, h);
 		fill(line);
+		free(line);
 	}
 
 	fclose(fp);



CVS commit: [netbsd-7-1] src/external/bsd/nvi/dist/cl

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:50:39 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl [netbsd-7-1]: cl_main.c cl_screen.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1508):
external/bsd/nvi/dist/cl/cl_main.c: revision 1.6
external/bsd/nvi/dist/cl/cl_screen.c: revision 1.6
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.
The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.
Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.
This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.1 -r1.4.6.1.2.1 src/external/bsd/nvi/dist/cl/cl_main.c \
src/external/bsd/nvi/dist/cl/cl_screen.c

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

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.4.6.1 src/external/bsd/nvi/dist/cl/cl_main.c:1.4.6.1.2.1
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.4.6.1	Sun Dec 18 06:37:30 2016
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Mon Oct 23 18:50:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $ */
+/*	$NetBSD: cl_main.c,v 1.4.6.1.2.1 2017/10/23 18:50:38 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.4.6.1.2.1 2017/10/23 18:50:38 snj Exp $");
 #endif
 
 #include 
@@ -311,6 +311,10 @@ h_winch(int signo)
 		continue;
 
 	F_SET(clp, CL_SIGWINCH);
+
+	/* If there was a previous handler, call that. */
+	if (clp->oact[INDX_WINCH].sa_handler)
+		clp->oact[INDX_WINCH].sa_handler(signo);
 }
 #undef	GLOBAL_CLP
 
Index: src/external/bsd/nvi/dist/cl/cl_screen.c
diff -u src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.6.1 src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.6.1.2.1
--- src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.6.1	Sun Dec 18 06:37:30 2016
+++ src/external/bsd/nvi/dist/cl/cl_screen.c	Mon Oct 23 18:50:38 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_screen.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $ */
+/*	$NetBSD: cl_screen.c,v 1.4.6.1.2.1 2017/10/23 18:50:38 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp  (Berkeley) Date: 2002/05/03 19:59:44 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_screen.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.4.6.1.2.1 2017/10/23 18:50:38 snj Exp $");
 #endif
 
 #include 
@@ -430,7 +430,7 @@ cl_vi_end(GS *gp)
 	 * Move to the bottom of the window (some endwin implementations don't
 	 * do this for you).
 	 */
-	if (!F_ISSET(clp, CL_IN_EX)) {
+	if (!F_ISSET(clp, CL_IN_EX) && !F_ISSET(gp, G_SRESTART)) {
 		(void)move(0, 0);
 		(void)deleteln();
 		(void)move(LINES - 1, 0);



CVS commit: [netbsd-7] src/external/bsd/nvi/dist/cl

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:50:41 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl [netbsd-7]: cl_main.c cl_screen.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1508):
external/bsd/nvi/dist/cl/cl_main.c: revision 1.6
external/bsd/nvi/dist/cl/cl_screen.c: revision 1.6
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.
The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.
Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.
This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.4.6.1 -r1.4.6.2 src/external/bsd/nvi/dist/cl/cl_main.c \
src/external/bsd/nvi/dist/cl/cl_screen.c

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

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.4.6.1 src/external/bsd/nvi/dist/cl/cl_main.c:1.4.6.2
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.4.6.1	Sun Dec 18 06:37:30 2016
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Mon Oct 23 18:50:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $ */
+/*	$NetBSD: cl_main.c,v 1.4.6.2 2017/10/23 18:50:40 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.4.6.2 2017/10/23 18:50:40 snj Exp $");
 #endif
 
 #include 
@@ -311,6 +311,10 @@ h_winch(int signo)
 		continue;
 
 	F_SET(clp, CL_SIGWINCH);
+
+	/* If there was a previous handler, call that. */
+	if (clp->oact[INDX_WINCH].sa_handler)
+		clp->oact[INDX_WINCH].sa_handler(signo);
 }
 #undef	GLOBAL_CLP
 
Index: src/external/bsd/nvi/dist/cl/cl_screen.c
diff -u src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.6.1 src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.6.2
--- src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.6.1	Sun Dec 18 06:37:30 2016
+++ src/external/bsd/nvi/dist/cl/cl_screen.c	Mon Oct 23 18:50:40 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_screen.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $ */
+/*	$NetBSD: cl_screen.c,v 1.4.6.2 2017/10/23 18:50:40 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp  (Berkeley) Date: 2002/05/03 19:59:44 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_screen.c,v 1.4.6.1 2016/12/18 06:37:30 snj Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.4.6.2 2017/10/23 18:50:40 snj Exp $");
 #endif
 
 #include 
@@ -430,7 +430,7 @@ cl_vi_end(GS *gp)
 	 * Move to the bottom of the window (some endwin implementations don't
 	 * do this for you).
 	 */
-	if (!F_ISSET(clp, CL_IN_EX)) {
+	if (!F_ISSET(clp, CL_IN_EX) && !F_ISSET(gp, G_SRESTART)) {
 		(void)move(0, 0);
 		(void)deleteln();
 		(void)move(LINES - 1, 0);



CVS commit: [netbsd-7-0] src/external/bsd/nvi/dist/cl

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:50:37 UTC 2017

Modified Files:
src/external/bsd/nvi/dist/cl [netbsd-7-0]: cl_main.c cl_screen.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1508):
external/bsd/nvi/dist/cl/cl_main.c: revision 1.6
external/bsd/nvi/dist/cl/cl_screen.c: revision 1.6
When resizing nvi in xterm, a scroll region is set with the old size
which garbles the display.
The scroll region is set for a terminfo scroll operation and then
reset to the current window size. While xterm lets you clear a
scroll region, there is no way to do this in terminfo except by
resetting the terminal which has a visual side effect.
Xterm actually clears the scroll region as part of the resize but
that happens before a program gets the SIGWINCH signal. When nvi sees
the SIGWINCH signal, it exits the vi mode using a scroll operation to
tidy up the display before it reenters vi mode with the new window size.
This patch does two things:
- make nvi also invoke a previous SIGWINCH handler (not sufficient,
  but that's how curses wants it).
- skip the tidy up in case of a restart (avoids the scroll region)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.4.10.1 src/external/bsd/nvi/dist/cl/cl_main.c \
src/external/bsd/nvi/dist/cl/cl_screen.c

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

Modified files:

Index: src/external/bsd/nvi/dist/cl/cl_main.c
diff -u src/external/bsd/nvi/dist/cl/cl_main.c:1.4 src/external/bsd/nvi/dist/cl/cl_main.c:1.4.10.1
--- src/external/bsd/nvi/dist/cl/cl_main.c:1.4	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/cl/cl_main.c	Mon Oct 23 18:50:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_main.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: cl_main.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_main.c,v 10.54 2001/07/29 19:07:27 skimo Exp  (Berkeley) Date: 2001/07/29 19:07:27 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_main.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: cl_main.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $");
 #endif
 
 #include 
@@ -294,6 +294,10 @@ h_winch(int signo)
 	GLOBAL_CLP;
 
 	F_SET(clp, CL_SIGWINCH);
+
+	/* If there was a previous handler, call that. */
+	if (clp->oact[INDX_WINCH].sa_handler)
+		clp->oact[INDX_WINCH].sa_handler(signo);
 }
 #undef	GLOBAL_CLP
 
Index: src/external/bsd/nvi/dist/cl/cl_screen.c
diff -u src/external/bsd/nvi/dist/cl/cl_screen.c:1.4 src/external/bsd/nvi/dist/cl/cl_screen.c:1.4.10.1
--- src/external/bsd/nvi/dist/cl/cl_screen.c:1.4	Sun Jan 26 21:43:45 2014
+++ src/external/bsd/nvi/dist/cl/cl_screen.c	Mon Oct 23 18:50:37 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: cl_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $ */
+/*	$NetBSD: cl_screen.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $ */
 /*-
  * Copyright (c) 1993, 1994
  *	The Regents of the University of California.  All rights reserved.
@@ -16,7 +16,7 @@
 static const char sccsid[] = "Id: cl_screen.c,v 10.56 2002/05/03 19:59:44 skimo Exp  (Berkeley) Date: 2002/05/03 19:59:44 ";
 #endif /* not lint */
 #else
-__RCSID("$NetBSD: cl_screen.c,v 1.4 2014/01/26 21:43:45 christos Exp $");
+__RCSID("$NetBSD: cl_screen.c,v 1.4.10.1 2017/10/23 18:50:37 snj Exp $");
 #endif
 
 #include 
@@ -404,7 +404,7 @@ cl_vi_end(GS *gp)
 	 * Move to the bottom of the window (some endwin implementations don't
 	 * do this for you).
 	 */
-	if (!F_ISSET(clp, CL_IN_EX)) {
+	if (!F_ISSET(clp, CL_IN_EX) && !F_ISSET(gp, G_SRESTART)) {
 		(void)move(0, 0);
 		(void)deleteln();
 		(void)move(LINES - 1, 0);



CVS commit: [netbsd-7] src/sys/dev/sysmon

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:57:12 UTC 2017

Modified Files:
src/sys/dev/sysmon [netbsd-7]: sysmon_envsys.c

Log Message:
Apply patch (requested by pgoyette in ticket #1511):
Detach the rndsrc before re-attaching it.


To generate a diff of this commit:
cvs rdiff -u -r1.127.2.1 -r1.127.2.2 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1 src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.2
--- src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1	Mon Apr  6 18:45:30 2015
+++ src/sys/dev/sysmon/sysmon_envsys.c	Mon Oct 23 18:57:12 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.127.2.2 2017/10/23 18:57:12 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.2 2017/10/23 18:57:12 snj Exp $");
 
 #include 
 #include 
@@ -1207,6 +1207,12 @@ sme_remove_userprops(void)
 			}
 
 			/*
+			 * Detach from entropy collection
+			 */
+			if (edata->flags & ENVSYS_FHAS_ENTROPY)
+rnd_detach_sources(>rnd_src);
+
+			/*
 			 * Finally, remove any old limits event, then
 			 * install a new event (which will update the
 			 * dictionary)



CVS commit: [netbsd-7-1] src/sys/dev/sysmon

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:57:10 UTC 2017

Modified Files:
src/sys/dev/sysmon [netbsd-7-1]: sysmon_envsys.c

Log Message:
Apply patch (requested by pgoyette in ticket #1511):
Detach the rndsrc before re-attaching it.


To generate a diff of this commit:
cvs rdiff -u -r1.127.2.1 -r1.127.2.1.6.1 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1 src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1.6.1
--- src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1	Mon Apr  6 18:45:30 2015
+++ src/sys/dev/sysmon/sysmon_envsys.c	Mon Oct 23 18:57:09 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.127.2.1.6.1 2017/10/23 18:57:09 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.1.6.1 2017/10/23 18:57:09 snj Exp $");
 
 #include 
 #include 
@@ -1207,6 +1207,12 @@ sme_remove_userprops(void)
 			}
 
 			/*
+			 * Detach from entropy collection
+			 */
+			if (edata->flags & ENVSYS_FHAS_ENTROPY)
+rnd_detach_sources(>rnd_src);
+
+			/*
 			 * Finally, remove any old limits event, then
 			 * install a new event (which will update the
 			 * dictionary)



CVS commit: [netbsd-7-0] src/sys/dev/sysmon

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 18:57:08 UTC 2017

Modified Files:
src/sys/dev/sysmon [netbsd-7-0]: sysmon_envsys.c

Log Message:
Apply patch (requested by pgoyette in ticket #1511):
Detach the rndsrc before re-attaching it.


To generate a diff of this commit:
cvs rdiff -u -r1.127.2.1 -r1.127.2.1.2.1 src/sys/dev/sysmon/sysmon_envsys.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1 src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1.2.1
--- src/sys/dev/sysmon/sysmon_envsys.c:1.127.2.1	Mon Apr  6 18:45:30 2015
+++ src/sys/dev/sysmon/sysmon_envsys.c	Mon Oct 23 18:57:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.127.2.1.2.1 2017/10/23 18:57:08 snj Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.1 2015/04/06 18:45:30 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.127.2.1.2.1 2017/10/23 18:57:08 snj Exp $");
 
 #include 
 #include 
@@ -1207,6 +1207,12 @@ sme_remove_userprops(void)
 			}
 
 			/*
+			 * Detach from entropy collection
+			 */
+			if (edata->flags & ENVSYS_FHAS_ENTROPY)
+rnd_detach_sources(>rnd_src);
+
+			/*
 			 * Finally, remove any old limits event, then
 			 * install a new event (which will update the
 			 * dictionary)



CVS commit: [netbsd-7] src/sys/fs/msdosfs

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:10:46 UTC 2017

Modified Files:
src/sys/fs/msdosfs [netbsd-7]: msdosfs_vfsops.c

Log Message:
Pull up following revision(s) (requested by mlelstv in ticket #1514):
sys/fs/msdosfs/msdosfs_vfsops.c: revision 1.128
Add more sanity checks for BPB parameters. Handle FAT12 format for media
with sectors >= 32kByte.
Does fix PR 52485.


To generate a diff of this commit:
cvs rdiff -u -r1.115 -r1.115.2.1 src/sys/fs/msdosfs/msdosfs_vfsops.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/fs/msdosfs/msdosfs_vfsops.c
diff -u src/sys/fs/msdosfs/msdosfs_vfsops.c:1.115 src/sys/fs/msdosfs/msdosfs_vfsops.c:1.115.2.1
--- src/sys/fs/msdosfs/msdosfs_vfsops.c:1.115	Fri Jul 18 17:24:34 2014
+++ src/sys/fs/msdosfs/msdosfs_vfsops.c	Mon Oct 23 19:10:46 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vfsops.c,v 1.115 2014/07/18 17:24:34 maxv Exp $	*/
+/*	$NetBSD: msdosfs_vfsops.c,v 1.115.2.1 2017/10/23 19:10:46 snj Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.115 2014/07/18 17:24:34 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: msdosfs_vfsops.c,v 1.115.2.1 2017/10/23 19:10:46 snj Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -468,6 +468,7 @@ msdosfs_mountfs(struct vnode *devvp, str
 	int	ronly, error, BlkPerSec;
 	uint64_t psize;
 	unsigned secsize;
+	u_long fatbytes, fatblocksecs;
 
 	/* Flush out any old buffers remaining from a previous use. */
 	if ((error = vinvalbuf(devvp, V_SAVE, l->l_cred, l, 0, 0)) != 0)
@@ -695,12 +696,40 @@ msdosfs_mountfs(struct vnode *devvp, str
 			pmp->pm_fatdiv = 1;
 		}
 	}
-	if (FAT12(pmp))
-		pmp->pm_fatblocksize = 3 * pmp->pm_BytesPerSec;
-	else
+
+	/* validate cluster count against FAT */
+	if ((pmp->pm_maxcluster & pmp->pm_fatmask) != pmp->pm_maxcluster) {
+		DPRINTF("maxcluster %lu outside of mask %#lx\n",
+			pmp->pm_maxcluster, pmp->pm_fatmask);
+		error = EINVAL;
+		goto error_exit;
+	}
+
+	/* validate FAT size */
+	fatbytes = (pmp->pm_maxcluster+1) * pmp->pm_fatmult / pmp->pm_fatdiv;
+	fatblocksecs = howmany(fatbytes, pmp->pm_BytesPerSec);
+
+	if (pmp->pm_FATsecs != fatblocksecs) {
+		DPRINTF("FATsecs %lu != real %lu\n", pmp->pm_FATsecs,
+			fatblocksecs);
+		error = EINVAL;
+		goto error_exit;
+	}
+
+	if (FAT12(pmp)) {
+		/*
+		 * limit block size to what is needed to read a FAT block
+		 * to not exceed MAXBSIZE
+		 */
+		pmp->pm_fatblocksec = min(3, fatblocksecs);
+		pmp->pm_fatblocksize = pmp->pm_fatblocksec
+			* pmp->pm_BytesPerSec;
+	} else {
 		pmp->pm_fatblocksize = MAXBSIZE;
+		pmp->pm_fatblocksec = pmp->pm_fatblocksize
+			/ pmp->pm_BytesPerSec;
+	}
 
-	pmp->pm_fatblocksec = pmp->pm_fatblocksize / pmp->pm_BytesPerSec;
 	pmp->pm_bnshift = ffs(pmp->pm_BytesPerSec) - 1;
 
 	/*



CVS commit: [netbsd-7-1] src/sbin/resize_ffs

2017-10-23 Thread Soren Jacobsen
Module Name:src
Committed By:   snj
Date:   Mon Oct 23 19:24:35 UTC 2017

Modified Files:
src/sbin/resize_ffs [netbsd-7-1]: resize_ffs.8 resize_ffs.c

Log Message:
Pull up following revision(s) (requested by sborrill in ticket #1516):
sbin/resize_ffs/resize_ffs.8: revision 1.18
sbin/resize_ffs/resize_ffs.c: revision 1.48-1.53
Fix the most obvious integer overflow errors which can lead to superblock
corruption. Thanks to riastradh@
--
Use int64_t for loop index so we don't iterate forever/until trap.
--
Fix the syntax (pointed out by David H. Gutteridge on source-changes-d).
Fix the build...
--
- More fixes to use 64bit offsets.
- Compute left-over fragments also for FFS2.
--
PR/52590: David H. Gutteridge: Minor documentation improvements
--
Fix computation of left-over fragments also for ufs2.
Fixes PR 52600.


To generate a diff of this commit:
cvs rdiff -u -r1.13.20.1 -r1.13.20.1.6.1 src/sbin/resize_ffs/resize_ffs.8
cvs rdiff -u -r1.38.6.2 -r1.38.6.2.2.1 src/sbin/resize_ffs/resize_ffs.c

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

Modified files:

Index: src/sbin/resize_ffs/resize_ffs.8
diff -u src/sbin/resize_ffs/resize_ffs.8:1.13.20.1 src/sbin/resize_ffs/resize_ffs.8:1.13.20.1.6.1
--- src/sbin/resize_ffs/resize_ffs.8:1.13.20.1	Thu Aug  6 21:13:44 2015
+++ src/sbin/resize_ffs/resize_ffs.8	Mon Oct 23 19:24:34 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: resize_ffs.8,v 1.13.20.1 2015/08/06 21:13:44 snj Exp $
+.\" $NetBSD: resize_ffs.8,v 1.13.20.1.6.1 2017/10/23 19:24:34 snj Exp $
 .\"
 .\" As its sole author, I explicitly place this man page in the public
 .\" domain.  Anyone may use it in any way for any purpose (though I would
@@ -9,7 +9,7 @@
 .\"  X  Against HTML   mo...@rodents.montreal.qc.ca
 .\" / \ Email!   7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B
 .\"
-.Dd April 6, 2015
+.Dd October 1, 2017
 .Dt RESIZE_FFS 8
 .Os
 .Sh NAME
@@ -128,10 +128,8 @@ command first appeared in
 .Aq r...@netbsd.org
 (Byteswapped file system and UFS2 support)
 .Pp
-A big bug-finding kudos goes to John Kohl for finding the rotational
-layout bug referred to in the
-.Sx WARNING
-section above.
+A big bug-finding kudos goes to John Kohl for finding a significant
+rotational layout bug.
 .Sh BUGS
 Can fail to shrink a file system when there actually is enough space,
 because it does not distinguish between a block allocated as a block

Index: src/sbin/resize_ffs/resize_ffs.c
diff -u src/sbin/resize_ffs/resize_ffs.c:1.38.6.2 src/sbin/resize_ffs/resize_ffs.c:1.38.6.2.2.1
--- src/sbin/resize_ffs/resize_ffs.c:1.38.6.2	Sat Sep 10 06:36:37 2016
+++ src/sbin/resize_ffs/resize_ffs.c	Mon Oct 23 19:24:34 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: resize_ffs.c,v 1.38.6.2 2016/09/10 06:36:37 snj Exp $	*/
+/*	$NetBSD: resize_ffs.c,v 1.38.6.2.2.1 2017/10/23 19:24:34 snj Exp $	*/
 /* From sources sent on February 17, 2003 */
 /*-
  * As its sole author, I explicitly place this code in the public
@@ -36,7 +36,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: resize_ffs.c,v 1.38.6.2 2016/09/10 06:36:37 snj Exp $");
+__RCSID("$NetBSD: resize_ffs.c,v 1.38.6.2.2.1 2017/10/23 19:24:34 snj Exp $");
 
 #include 
 #include 
@@ -462,10 +462,10 @@ static void
 initcg(int cgn)
 {
 	struct cg *cg;		/* The in-core cg, of course */
-	int base;		/* Disk address of cg base */
-	int dlow;		/* Size of pre-cg data area */
-	int dhigh;		/* Offset of post-inode data area, from base */
-	int dmax;		/* Offset of end of post-inode data area */
+	int64_t base;		/* Disk address of cg base */
+	int64_t dlow;		/* Size of pre-cg data area */
+	int64_t dhigh;		/* Offset of post-inode data area, from base */
+	int64_t dmax;		/* Offset of end of post-inode data area */
 	int i;			/* Generic loop index */
 	int n;			/* Generic count */
 	int start;		/* start of cg maps */
@@ -478,7 +478,7 @@ initcg(int cgn)
 	dmax = newsb->fs_size - base;
 	if (dmax > newsb->fs_fpg)
 		dmax = newsb->fs_fpg;
-	start = >cg_space[0] - (unsigned char *) cg;
+	start = (unsigned char *)>cg_space[0] - (unsigned char *) cg;
 	/*
  * Clear out the cg - assumes all-0-bytes is the correct way
  * to initialize fields we don't otherwise touch, which is
@@ -564,13 +564,16 @@ initcg(int cgn)
 	 * below for the post-inode data area, is that the pre-sb data
 	 * area always starts at 0, and thus is block-aligned, and
 	 * always ends at the sb, which is block-aligned.) */
-	if ((newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0)
-		for (i = 0; i < dlow; i += newsb->fs_frag) {
-			old_cg_blktot(cg, 0)[old_cbtocylno(newsb, i)]++;
+	if ((newsb->fs_old_flags & FS_FLAGS_UPDATED) == 0) {
+		int64_t di;
+
+		for (di = 0; di < dlow; di += newsb->fs_frag) {
+			old_cg_blktot(cg, 0)[old_cbtocylno(newsb, di)]++;
 			old_cg_blks(newsb, cg,
-			old_cbtocylno(newsb, i),
-			0)[old_cbtorpos(newsb, i)]++;
+			old_cbtocylno(newsb, di),
+			0)[old_cbtorpos(newsb, di)]++;
 		}
+	}
 
 	/* 

CVS commit: src/sys/dev/ic

2017-10-23 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Mon Oct 23 15:08:05 UTC 2017

Modified Files:
src/sys/dev/ic: dwc_gmac.c

Log Message:
We don't need '', but just 'mii' for mii_detach().


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/ic/dwc_gmac.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/dwc_gmac.c
diff -u src/sys/dev/ic/dwc_gmac.c:1.41 src/sys/dev/ic/dwc_gmac.c:1.42
--- src/sys/dev/ic/dwc_gmac.c:1.41	Mon Oct 23 09:27:46 2017
+++ src/sys/dev/ic/dwc_gmac.c	Mon Oct 23 15:08:05 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: dwc_gmac.c,v 1.41 2017/10/23 09:27:46 msaitoh Exp $ */
+/* $NetBSD: dwc_gmac.c,v 1.42 2017/10/23 15:08:05 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2013, 2014 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
 
 #include 
 
-__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.41 2017/10/23 09:27:46 msaitoh Exp $");
+__KERNEL_RCSID(1, "$NetBSD: dwc_gmac.c,v 1.42 2017/10/23 15:08:05 jakllsch Exp $");
 
 /* #define	DWC_GMAC_DEBUG	1 */
 
@@ -282,7 +282,7 @@ dwc_gmac_attach(struct dwc_gmac_softc *s
 	return;
 fail_2:
 	ifmedia_removeall(>mii_media);
-	mii_detach(, MII_PHY_ANY, MII_OFFSET_ANY);
+	mii_detach(mii, MII_PHY_ANY, MII_OFFSET_ANY);
 	mutex_destroy(>sc_txq.t_mtx);
 	mutex_destroy(>sc_rxq.r_mtx);
 	mutex_obj_free(sc->sc_lock);



CVS commit: src/sys/dev/ic

2017-10-23 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Mon Oct 23 15:21:11 UTC 2017

Modified Files:
src/sys/dev/ic: bwfm.c

Log Message:
Initialize txrate to 0 for new associations; firmware handles rate adaptation 
for us


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/bwfm.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/bwfm.c
diff -u src/sys/dev/ic/bwfm.c:1.3 src/sys/dev/ic/bwfm.c:1.4
--- src/sys/dev/ic/bwfm.c:1.3	Mon Oct 23 09:31:17 2017
+++ src/sys/dev/ic/bwfm.c	Mon Oct 23 15:21:10 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: bwfm.c,v 1.3 2017/10/23 09:31:17 msaitoh Exp $ */
+/* $NetBSD: bwfm.c,v 1.4 2017/10/23 15:21:10 jmcneill Exp $ */
 /* $OpenBSD: bwfm.c,v 1.5 2017/10/16 22:27:16 patrick Exp $ */
 /*
  * Copyright (c) 2010-2016 Broadcom Corporation
@@ -71,6 +71,7 @@ int	 bwfm_key_set(struct ieee80211com *,
 int	 bwfm_key_delete(struct ieee80211com *, const struct ieee80211_key *);
 int	 bwfm_newstate(struct ieee80211com *, enum ieee80211_state, int);
 void	 bwfm_newstate_cb(struct bwfm_softc *, struct bwfm_cmd_newstate *);
+void	 bwfm_newassoc(struct ieee80211_node *, int);
 void	 bwfm_task(struct work *, void *);
 
 int	 bwfm_chip_attach(struct bwfm_softc *);
@@ -248,6 +249,7 @@ bwfm_attach(struct bwfm_softc *sc)
 
 	sc->sc_newstate = ic->ic_newstate;
 	ic->ic_newstate = bwfm_newstate;
+	ic->ic_newassoc = bwfm_newassoc;
 	ic->ic_send_mgmt = bwfm_send_mgmt;
 	ic->ic_recv_mgmt = bwfm_recv_mgmt;
 	ic->ic_crypto.cs_key_set = bwfm_key_set;
@@ -725,6 +727,13 @@ bwfm_newstate_cb(struct bwfm_softc *sc, 
 }
 
 void
+bwfm_newassoc(struct ieee80211_node *ni, int isnew)
+{
+	/* Firmware handles rate adaptation for us */
+	ni->ni_txrate = 0;
+}
+
+void
 bwfm_task(struct work *wk, void *arg)
 {
 	struct bwfm_task *t = (struct bwfm_task *)wk;



CVS commit: src/lib/libform

2017-10-23 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Oct 23 15:23:56 UTC 2017

Modified Files:
src/lib/libform: form_data.3

Log Message:
Add the function names to the NAME section


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/libform/form_data.3

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

Modified files:

Index: src/lib/libform/form_data.3
diff -u src/lib/libform/form_data.3:1.9 src/lib/libform/form_data.3:1.10
--- src/lib/libform/form_data.3:1.9	Mon Mar 22 21:58:31 2010
+++ src/lib/libform/form_data.3	Mon Oct 23 15:23:55 2017
@@ -1,4 +1,4 @@
-.\"	$NetBSD: form_data.3,v 1.9 2010/03/22 21:58:31 joerg Exp $
+.\"	$NetBSD: form_data.3,v 1.10 2017/10/23 15:23:55 abhinav Exp $
 .\"
 .\" Copyright (c) 2001
 .\"	Brett Lymn - bl...@baea.com.au, brett_l...@yahoo.com.au
@@ -33,7 +33,8 @@
 .Dt FORM_DATA 3
 .Os
 .Sh NAME
-.Nm form
+.Nm data_ahead ,
+.Nm data_behind
 .Nd form library
 .Sh LIBRARY
 .Lb libform



CVS commit: src/sys/arch/usermode/include

2017-10-23 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Oct 23 06:43:00 UTC 2017

Modified Files:
src/sys/arch/usermode/include: lock.h

Log Message:
 Fix compile error. Use const correctly.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/usermode/include/lock.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/arch/usermode/include/lock.h
diff -u src/sys/arch/usermode/include/lock.h:1.4 src/sys/arch/usermode/include/lock.h:1.5
--- src/sys/arch/usermode/include/lock.h:1.4	Sun Sep 17 00:01:08 2017
+++ src/sys/arch/usermode/include/lock.h	Mon Oct 23 06:43:00 2017
@@ -1,4 +1,4 @@
-/* $NetBSD: lock.h,v 1.4 2017/09/17 00:01:08 christos Exp $ */
+/* $NetBSD: lock.h,v 1.5 2017/10/23 06:43:00 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -30,13 +30,13 @@
 #define _ARCH_USERMODE_INCLUDE_LOCK_H
 
 __inline static void
-__cpu_simple_lock_init(const __cpu_simple_lock_t *lockp)
+__cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
 {
 	*lockp = __SIMPLELOCK_UNLOCKED;
 }
 
 __inline static int
-__cpu_simple_lock_try(const __cpu_simple_lock_t *lockp)
+__cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
 {
 	if (*lockp == __SIMPLELOCK_LOCKED)
 		return 0;
@@ -58,13 +58,13 @@ __cpu_simple_unlock(__cpu_simple_lock_t 
 }
 
 __inline static int
-__SIMPLELOCK_LOCKED_P(__cpu_simple_lock_t *lockp)
+__SIMPLELOCK_LOCKED_P(const __cpu_simple_lock_t *lockp)
 {
 	return *lockp == __SIMPLELOCK_LOCKED;
 }
 
 __inline static int
-__SIMPLELOCK_UNLOCKED_P(__cpu_simple_lock_t *lockp)
+__SIMPLELOCK_UNLOCKED_P(const __cpu_simple_lock_t *lockp)
 {
 	return *lockp == __SIMPLELOCK_UNLOCKED;
 }



CVS commit: src/lib/librumphijack

2017-10-23 Thread Ryota Ozaki
Module Name:src
Committed By:   ozaki-r
Date:   Mon Oct 23 06:52:17 UTC 2017

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Provide better debug messages for ioctl


To generate a diff of this commit:
cvs rdiff -u -r1.123 -r1.124 src/lib/librumphijack/hijack.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/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.123 src/lib/librumphijack/hijack.c:1.124
--- src/lib/librumphijack/hijack.c:1.123	Tue Jun  6 19:48:42 2017
+++ src/lib/librumphijack/hijack.c	Mon Oct 23 06:52:17 2017
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.123 2017/06/06 19:48:42 christos Exp $	*/
+/*  $NetBSD: hijack.c,v 1.124 2017/10/23 06:52:17 ozaki-r Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -34,7 +34,7 @@
 #include 
 
 #if !defined(lint)
-__RCSID("$NetBSD: hijack.c,v 1.123 2017/06/06 19:48:42 christos Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.124 2017/10/23 06:52:17 ozaki-r Exp $");
 #endif
 
 #include 
@@ -1406,7 +1406,7 @@ ioctl(int fd, unsigned long cmd, ...)
 	va_list ap;
 	int rv;
 
-	DPRINTF(("ioctl -> %d\n", fd));
+	DPRINTF(("ioctl -> %d (%s)\n", fd, whichfd(fd)));
 	if (fd_isrump(fd)) {
 		fd = fd_host2rump(fd);
 		op_ioctl = GETSYSCALL(rump, IOCTL);
@@ -1417,6 +1417,7 @@ ioctl(int fd, unsigned long cmd, ...)
 	va_start(ap, cmd);
 	rv = op_ioctl(fd, cmd, va_arg(ap, void *));
 	va_end(ap);
+	DPRINTF(("ioctl <- %d\n", rv));
 	return rv;
 }
 



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

2017-10-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 23 07:05:23 UTC 2017

Modified Files:
src/sys/arch/evbarm/evbarm: autoconf.c

Log Message:
splserial is an alias for splhigh now. No need to splhigh twice.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/evbarm/evbarm/autoconf.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/evbarm/evbarm/autoconf.c
diff -u src/sys/arch/evbarm/evbarm/autoconf.c:1.20 src/sys/arch/evbarm/evbarm/autoconf.c:1.21
--- src/sys/arch/evbarm/evbarm/autoconf.c:1.20	Sun May 28 00:30:49 2017
+++ src/sys/arch/evbarm/evbarm/autoconf.c	Mon Oct 23 07:05:23 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.21 2017/10/23 07:05:23 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.20 2017/05/28 00:30:49 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: autoconf.c,v 1.21 2017/10/23 07:05:23 skrll Exp $");
 
 #include "opt_md.h"
 
@@ -169,7 +169,6 @@ cpu_configure(void)
 	struct cfdata *cf;
 
 	(void) splhigh();
-	(void) splserial();	/* XXX need an splextreme() */
 
 	for (cf = [0]; cf->cf_name; cf++) {
 		if (cf->cf_pspec == NULL) {



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

2017-10-23 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Oct 23 08:08:53 UTC 2017

Modified Files:
src/sys/arch/i386/conf: GENERIC

Log Message:
Add bwfm (and sort other 802.11 usb wifi drivers)


To generate a diff of this commit:
cvs rdiff -u -r1.1168 -r1.1169 src/sys/arch/i386/conf/GENERIC

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/i386/conf/GENERIC
diff -u src/sys/arch/i386/conf/GENERIC:1.1168 src/sys/arch/i386/conf/GENERIC:1.1169
--- src/sys/arch/i386/conf/GENERIC:1.1168	Thu Sep 14 07:58:41 2017
+++ src/sys/arch/i386/conf/GENERIC	Mon Oct 23 08:08:53 2017
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.1168 2017/09/14 07:58:41 mrg Exp $
+# $NetBSD: GENERIC,v 1.1169 2017/10/23 08:08:53 skrll Exp $
 #
 # GENERIC machine description file
 #
@@ -22,7 +22,7 @@ include 	"arch/i386/conf/std.i386"
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident		"GENERIC-$Revision: 1.1168 $"
+#ident		"GENERIC-$Revision: 1.1169 $"
 
 maxusers	64		# estimated number of users
 
@@ -1260,11 +1260,12 @@ urndis*	at uhub? port ?		# Microsoft RND
 # USB 802.11 adapters
 athn*	at uhub? port ?		# Atheros AR9002U
 atu*	at uhub? port ?		# Atmel AT76C50XX based adapters
+bwfm*	at uhub? port ?		# Broadcom FullMAC
 otus*	at uhub? port ?		# Atheros AR9001U
-ural*	at uhub? port ?		# Ralink Technology RT2500USB 802.11a/b/g
 rum*	at uhub? port ?		# Ralink Technology RT2501/RT2601 802.11a/b/g
 run*	at uhub? port ?		# Ralink Technology RT(2[78]|30)00 802.11a/b/g/n
 upgt*	at uhub? port ?		# Intersil PrismGT
+ural*	at uhub? port ?		# Ralink Technology RT2500USB 802.11a/b/g
 urtw*	at uhub? port ?		# Realtek RTL8187/RTL8187B 802.11b/g
 urtwn*	at uhub? port ?		# Realtek RTL8188CU/RTL8192CU 802.11b/g/n
 zyd*	at uhub? port ?		# Zydas ZD1211



CVS commit: src/lib/libform

2017-10-23 Thread Abhinav Upadhyay
Module Name:src
Committed By:   abhinav
Date:   Mon Oct 23 15:34:45 UTC 2017

Modified Files:
src/lib/libform: Makefile

Log Message:
Remove duplicate MLINK entry for dup_field.3
(it's already defined 3 lines above)


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libform/Makefile

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

Modified files:

Index: src/lib/libform/Makefile
diff -u src/lib/libform/Makefile:1.10 src/lib/libform/Makefile:1.11
--- src/lib/libform/Makefile:1.10	Wed Mar 21 05:38:49 2012
+++ src/lib/libform/Makefile	Mon Oct 23 15:34:45 2017
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2012/03/21 05:38:49 matt Exp $
+#	$NetBSD: Makefile,v 1.11 2017/10/23 15:34:45 abhinav Exp $
 #
 
 WARNS=	2
@@ -26,7 +26,7 @@ MLINKS+=	forms.3 form.3 form_page.3 curr
 		form_data.3 data_ahead.3 form_field_new.3 dup_field.3 \
 		form_field_info.3 dynamic_field_info.3 \
 		form_page.3 current_field.3 form_data.3 data_ahead.3 \
-		form_data.3 data_behind.3 form_field_new.3 dup_field.3 \
+		form_data.3 data_behind.3 \
 		form_field_info.3 dynamic_field_info.3 \
 		form_field_validation.3 field_arg.3 \
 		form_field_attributes.3 field_back.3 \