CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr  4 06:19:02 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhcivar.h

Log Message:
Change isdone to bool.  Missed in previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.52.14.5 -r1.52.14.6 src/sys/dev/usb/uhcivar.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/usb/uhcivar.h
diff -u src/sys/dev/usb/uhcivar.h:1.52.14.5 src/sys/dev/usb/uhcivar.h:1.52.14.6
--- src/sys/dev/usb/uhcivar.h:1.52.14.5	Thu Mar 19 17:26:43 2015
+++ src/sys/dev/usb/uhcivar.h	Sat Apr  4 06:19:02 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhcivar.h,v 1.52.14.5 2015/03/19 17:26:43 skrll Exp $	*/
+/*	$NetBSD: uhcivar.h,v 1.52.14.6 2015/04/04 06:19:02 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -72,7 +72,7 @@ typedef struct uhci_intr_info {
 	uhci_soft_td_t *stdstart;
 	uhci_soft_td_t *stdend;
 	LIST_ENTRY(uhci_intr_info) list;
-	int isdone;	/* used only when DIAGNOSTIC is defined */
+	bool isdone;	/* used only when DIAGNOSTIC is defined */
 } uhci_intr_info_t;
 
 struct uhci_xfer {



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr  4 06:19:02 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhcivar.h

Log Message:
Change isdone to bool.  Missed in previous commit.


To generate a diff of this commit:
cvs rdiff -u -r1.52.14.5 -r1.52.14.6 src/sys/dev/usb/uhcivar.h

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



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr  4 06:22:06 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehcireg.h ohcireg.h uhcireg.h

Log Message:
Correct directory reference in multiple inclusion protection variable
name


To generate a diff of this commit:
cvs rdiff -u -r1.34.14.8 -r1.34.14.9 src/sys/dev/usb/ehcireg.h
cvs rdiff -u -r1.24.6.3 -r1.24.6.4 src/sys/dev/usb/ohcireg.h
cvs rdiff -u -r1.19.66.1 -r1.19.66.2 src/sys/dev/usb/uhcireg.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/usb/ehcireg.h
diff -u src/sys/dev/usb/ehcireg.h:1.34.14.8 src/sys/dev/usb/ehcireg.h:1.34.14.9
--- src/sys/dev/usb/ehcireg.h:1.34.14.8	Mon Mar 30 11:57:12 2015
+++ src/sys/dev/usb/ehcireg.h	Sat Apr  4 06:22:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehcireg.h,v 1.34.14.8 2015/03/30 11:57:12 skrll Exp $	*/
+/*	$NetBSD: ehcireg.h,v 1.34.14.9 2015/04/04 06:22:06 skrll Exp $	*/
 
 /*
  * Copyright (c) 2001, 2004 The NetBSD Foundation, Inc.
@@ -36,8 +36,8 @@
  * http://www.usb.org/developers/data/usb_20.zip
  */
 
-#ifndef _DEV_PCI_EHCIREG_H_
-#define _DEV_PCI_EHCIREG_H_
+#ifndef _DEV_USB_EHCIREG_H_
+#define _DEV_USB_EHCIREG_H_
 
 /*** PCI config registers ***/
 
@@ -433,4 +433,4 @@ typedef struct {
 #define  EHCI_DAR_ENDPOINT	__BITS(3,0)
 #define  EHCI_DAR_ADDRESS	__BITS(14,8)
 
-#endif /* _DEV_PCI_EHCIREG_H_ */
+#endif /* _DEV_USB_EHCIREG_H_ */

Index: src/sys/dev/usb/ohcireg.h
diff -u src/sys/dev/usb/ohcireg.h:1.24.6.3 src/sys/dev/usb/ohcireg.h:1.24.6.4
--- src/sys/dev/usb/ohcireg.h:1.24.6.3	Mon Mar 30 11:56:42 2015
+++ src/sys/dev/usb/ohcireg.h	Sat Apr  4 06:22:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohcireg.h,v 1.24.6.3 2015/03/30 11:56:42 skrll Exp $	*/
+/*	$NetBSD: ohcireg.h,v 1.24.6.4 2015/04/04 06:22:06 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ohcireg.h,v 1.8 1999/11/17 22:33:40 n_hibma Exp $	*/
 
 /*
@@ -31,8 +31,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _DEV_PCI_OHCIREG_H_
-#define _DEV_PCI_OHCIREG_H_
+#ifndef _DEV_USB_OHCIREG_H_
+#define _DEV_USB_OHCIREG_H_
 
 /*** PCI config registers ***/
 
@@ -239,4 +239,4 @@ typedef struct {
 #define OHCI_ENABLE_POWER_DELAY	5
 #define OHCI_READ_DESC_DELAY	5
 
-#endif /* _DEV_PCI_OHCIREG_H_ */
+#endif /* _DEV_USB_OHCIREG_H_ */

Index: src/sys/dev/usb/uhcireg.h
diff -u src/sys/dev/usb/uhcireg.h:1.19.66.1 src/sys/dev/usb/uhcireg.h:1.19.66.2
--- src/sys/dev/usb/uhcireg.h:1.19.66.1	Sun Nov 30 12:18:58 2014
+++ src/sys/dev/usb/uhcireg.h	Sat Apr  4 06:22:06 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhcireg.h,v 1.19.66.1 2014/11/30 12:18:58 skrll Exp $	*/
+/*	$NetBSD: uhcireg.h,v 1.19.66.2 2015/04/04 06:22:06 skrll Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhcireg.h,v 1.12 1999/11/17 22:33:42 n_hibma Exp $ */
 
 /*
@@ -31,8 +31,8 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef _DEV_PCI_UHCIREG_H_
-#define _DEV_PCI_UHCIREG_H_
+#ifndef _DEV_USB_UHCIREG_H_
+#define _DEV_USB_UHCIREG_H_
 
 /*** PCI config registers ***/
 
@@ -194,4 +194,4 @@ typedef struct {
 	volatile uhci_physaddr_t qh_elink;
 } uhci_qh_t;
 
-#endif /* _DEV_PCI_UHCIREG_H_ */
+#endif /* _DEV_USB_UHCIREG_H_ */



CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-04 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sat Apr  4 06:22:06 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehcireg.h ohcireg.h uhcireg.h

Log Message:
Correct directory reference in multiple inclusion protection variable
name


To generate a diff of this commit:
cvs rdiff -u -r1.34.14.8 -r1.34.14.9 src/sys/dev/usb/ehcireg.h
cvs rdiff -u -r1.24.6.3 -r1.24.6.4 src/sys/dev/usb/ohcireg.h
cvs rdiff -u -r1.19.66.1 -r1.19.66.2 src/sys/dev/usb/uhcireg.h

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



CVS commit: src/sys/ufs/ffs

2015-04-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr  4 06:00:12 UTC 2015

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
ffs_superblock_validate(): ensure fs_ncg!=0 and fs_maxbpg!=0 to prevent
several divisions by zero.


To generate a diff of this commit:
cvs rdiff -u -r1.327 -r1.328 src/sys/ufs/ffs/ffs_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/ufs/ffs/ffs_vfsops.c
diff -u src/sys/ufs/ffs/ffs_vfsops.c:1.327 src/sys/ufs/ffs/ffs_vfsops.c:1.328
--- src/sys/ufs/ffs/ffs_vfsops.c:1.327	Sat Mar 28 19:24:04 2015
+++ src/sys/ufs/ffs/ffs_vfsops.c	Sat Apr  4 06:00:12 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ffs_vfsops.c,v 1.327 2015/03/28 19:24:04 maxv Exp $	*/
+/*	$NetBSD: ffs_vfsops.c,v 1.328 2015/04/04 06:00:12 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.327 2015/03/28 19:24:04 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: ffs_vfsops.c,v 1.328 2015/04/04 06:00:12 maxv Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_ffs.h
@@ -952,6 +952,10 @@ ffs_superblock_validate(struct fs *fs)
 		return 0;
 	if (fs-fs_fpg == 0)
 		return 0;
+	if (fs-fs_ncg == 0)
+		return 0;
+	if (fs-fs_maxbpg == 0)
+		return 0;
 
 	/* Check the number of inodes per block */
 	if (fs-fs_magic == FS_UFS1_MAGIC)



CVS commit: src/sys/ufs/ffs

2015-04-04 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Sat Apr  4 06:00:12 UTC 2015

Modified Files:
src/sys/ufs/ffs: ffs_vfsops.c

Log Message:
ffs_superblock_validate(): ensure fs_ncg!=0 and fs_maxbpg!=0 to prevent
several divisions by zero.


To generate a diff of this commit:
cvs rdiff -u -r1.327 -r1.328 src/sys/ufs/ffs/ffs_vfsops.c

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



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

2015-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  4 14:56:48 UTC 2015

Modified Files:
src/sys/net [netbsd-7]: if_vlan.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #653):
sys/net/if_vlan.c: revision 1.80
Correct frame padding length
vlan pads a frame with zeros up to 68 bytes
(ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN). It expects
that even if the frame is untagged, it keeps 64 bytes
at least. However, it lacks concern about CRC
(4 bytes). So a sending frame can be 72 (68 + 4) bytes.
PR 49788


To generate a diff of this commit:
cvs rdiff -u -r1.70.2.1 -r1.70.2.2 src/sys/net/if_vlan.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_vlan.c
diff -u src/sys/net/if_vlan.c:1.70.2.1 src/sys/net/if_vlan.c:1.70.2.2
--- src/sys/net/if_vlan.c:1.70.2.1	Mon Sep 22 10:44:37 2014
+++ src/sys/net/if_vlan.c	Sat Apr  4 14:56:48 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.70.2.1 2014/09/22 10:44:37 martin Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.70.2.2 2015/04/04 14:56:48 martin Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.70.2.1 2014/09/22 10:44:37 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.70.2.2 2015/04/04 14:56:48 martin Exp $);
 
 #include opt_inet.h
 
@@ -791,9 +791,10 @@ vlan_start(struct ifnet *ifp)
  * after deleting a tag.
  */
 if (m-m_pkthdr.len 
-(ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN)) {
+(ETHER_MIN_LEN - ETHER_CRC_LEN +
+ ETHER_VLAN_ENCAP_LEN)) {
 	m_copyback(m, m-m_pkthdr.len,
-	(ETHER_MIN_LEN +
+	(ETHER_MIN_LEN - ETHER_CRC_LEN +
 	 ETHER_VLAN_ENCAP_LEN) -
 	 m-m_pkthdr.len,
 	vlan_zero_pad_buff);



CVS commit: src/sys/dev/if_ndis

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:22:02 UTC 2015

Modified Files:
src/sys/dev/if_ndis: if_ndis_pci.c

Log Message:
don't leak rl (but there are other leaks), found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/if_ndis/if_ndis_pci.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/if_ndis/if_ndis_pci.c
diff -u src/sys/dev/if_ndis/if_ndis_pci.c:1.20 src/sys/dev/if_ndis/if_ndis_pci.c:1.21
--- src/sys/dev/if_ndis/if_ndis_pci.c:1.20	Mon Sep  1 15:46:55 2014
+++ src/sys/dev/if_ndis/if_ndis_pci.c	Sat Apr  4 11:22:02 2015
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ndis_pci.c,v 1.20 2014/09/01 19:46:55 he Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ndis_pci.c,v 1.21 2015/04/04 15:22:02 christos Exp $);
 #ifdef __FreeBSD__
 __FBSDID($FreeBSD: src/sys/dev/if_ndis/if_ndis_pci.c,v 1.8.2.3 2005/03/31 04:24:36 wpaul Exp $);
 #endif
@@ -204,6 +204,7 @@ void ndis_attach_pci(device_t parent, de
 	int revision, i;
 #endif
 	int bar;
+	size_t rllen;
 	
 	printf(in ndis_attach_pci()\n);
 
@@ -227,9 +228,9 @@ void ndis_attach_pci(device_t parent, de
 	
 	printf(sc-ndis_mtag = %x\n, (unsigned int)sc-ndis_mtag);
 
-	rl = malloc(sizeof(ndis_resource_list) +
-	(sizeof(cm_partial_resource_desc) * (MAX_RESOURCES-1)),
-	M_DEVBUF, M_NOWAIT|M_ZERO);
+	rllen = sizeof(ndis_resource_list) +
+	sizeof(cm_partial_resource_desc) * (MAX_RESOURCES - 1);
+	rl = malloc(rllen, M_DEVBUF, M_NOWAIT|M_ZERO);
 
 	if(rl == NULL) {
 		sc-error = ENOMEM;
@@ -272,7 +273,7 @@ void ndis_attach_pci(device_t parent, de
 	malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
 	//printf(error: out of memory\n);
 	sc-error = ENOMEM;
-	return;
+	goto out;
 }
 sc-ndis_res_io-res_base = base;
 sc-ndis_res_io-res_size = size;
@@ -293,7 +294,7 @@ void ndis_attach_pci(device_t parent, de
 	sc-ndis_res_altmem != NULL) {
 	printf(too many resources\n);
 	sc-error = ENXIO;
-	return;
+	goto out;
 }
 if(sc-ndis_res_mem) {
 	if((sc-ndis_res_altmem = 
@@ -317,7 +318,7 @@ void ndis_attach_pci(device_t parent, de
 	if((sc-ndis_res_mem = 
 		malloc(sizeof(struct ndis_resource), M_DEVBUF, M_NOWAIT | M_ZERO)) == NULL) {
 		sc-error = ENOMEM;
-		return;
+		goto out;
 	}
 	sc-ndis_res_mem-res_base = base;
 	sc-ndis_res_mem-res_size = size;
@@ -364,6 +365,10 @@ void ndis_attach_pci(device_t parent, de
 	
 	kthread_create(PRI_NONE, 0, NULL, ndis_attach, (void *)sc,
 	NULL, ndis_attach);
+	return;
+out:
+	free(rl, M_DEVBUF); 
+	return;
 }
 
 



CVS commit: src/sys/external/bsd/drm2/include/drm

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:46:53 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/include/drm: drm_wait_netbsd.h

Log Message:
In DRM_SPIN_WAIT_ON, don't stop after waiting only one tick.

Continue the loop to recheck the condition and count the whole
duration.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h

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



CVS commit: src/sys/external/bsd/drm2/include/drm

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:46:53 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/include/drm: drm_wait_netbsd.h

Log Message:
In DRM_SPIN_WAIT_ON, don't stop after waiting only one tick.

Continue the loop to recheck the condition and count the whole
duration.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 \
src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.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/external/bsd/drm2/include/drm/drm_wait_netbsd.h
diff -u src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.11 src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.12
--- src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h:1.11	Sat Feb 28 21:30:22 2015
+++ src/sys/external/bsd/drm2/include/drm/drm_wait_netbsd.h	Sat Apr  4 15:46:53 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: drm_wait_netbsd.h,v 1.11 2015/02/28 21:30:22 riastradh Exp $	*/
+/*	$NetBSD: drm_wait_netbsd.h,v 1.12 2015/04/04 15:46:53 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -147,7 +147,8 @@ DRM_SPIN_WAKEUP_ALL(drm_waitqueue_t *q, 
 		(RET) = -cv_timedwait_sig((Q), (INTERLOCK)-sl_lock, 1); \
 		if (RET) {		  \
 			if ((RET) == -EWOULDBLOCK)			  \
-(RET) = (CONDITION) ? 0 : -EBUSY;	  \
+/* Waited only one tick.  */		  \
+continue;  \
 			break;		  \
 		}			  \
 	}  \



Re: CVS commit: src

2015-04-04 Thread Christos Zoulas
+20150404:
+  Lint changes require a full rebuild of the tool, so make
+  sure to build without -u option to build.sh, or manually
+  do a make cleandir in src/tools/lint1 and
+  src/usr.bin/xlint.
+

This indicates some broken dependencies, and should not be needed...
Let's investigate more?

christos



CVS commit: src/sys/dev/ic

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:10:47 UTC 2015

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

Log Message:
fix double free, found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/ic/mfi.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/mfi.c
diff -u src/sys/dev/ic/mfi.c:1.56 src/sys/dev/ic/mfi.c:1.57
--- src/sys/dev/ic/mfi.c:1.56	Thu Mar 12 11:33:10 2015
+++ src/sys/dev/ic/mfi.c	Sat Apr  4 11:10:47 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: mfi.c,v 1.56 2015/03/12 15:33:10 christos Exp $ */
+/* $NetBSD: mfi.c,v 1.57 2015/04/04 15:10:47 christos Exp $ */
 /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */
 
 /*
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.56 2015/03/12 15:33:10 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: mfi.c,v 1.57 2015/04/04 15:10:47 christos Exp $);
 
 #include bio.h
 
@@ -3404,8 +3404,7 @@ again:
 
 	ld_size = sizeof(*ld_sync) * sc-sc_ld_list.mll_no_ld;
 	
-	ld_sync = (struct mfi_ld *) malloc(ld_size, M_DEVBUF,
-	 M_WAITOK | M_ZERO);
+	ld_sync = malloc(ld_size, M_DEVBUF, M_WAITOK | M_ZERO);
 	if (ld_sync == NULL) {
 		aprint_error_dev(sc-sc_dev, Failed to allocate sync\n);
 		goto err;
@@ -3416,7 +3415,6 @@ again:
 
 	if ((ccb = mfi_get_ccb(sc)) == NULL) {
 		aprint_error_dev(sc-sc_dev, Failed to get sync command\n);
-		free(ld_sync, M_DEVBUF);
 		goto err;
 	}
 	sc-sc_ldsync_ccb = ccb;



CVS commit: src/sys/dev/ic

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:10:47 UTC 2015

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

Log Message:
fix double free, found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/ic/mfi.c

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



CVS commit: src/sys/dev/if_ndis

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:22:02 UTC 2015

Modified Files:
src/sys/dev/if_ndis: if_ndis_pci.c

Log Message:
don't leak rl (but there are other leaks), found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/dev/if_ndis/if_ndis_pci.c

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



CVS commit: src

2015-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  4 12:15:38 UTC 2015

Modified Files:
src: UPDATING

Log Message:
Note required cleandir for lint changes


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/UPDATING

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

Modified files:

Index: src/UPDATING
diff -u src/UPDATING:1.260 src/UPDATING:1.261
--- src/UPDATING:1.260	Wed Mar 11 08:50:32 2015
+++ src/UPDATING	Sat Apr  4 12:15:38 2015
@@ -1,4 +1,4 @@
-$NetBSD: UPDATING,v 1.260 2015/03/11 08:50:32 skrll Exp $
+$NetBSD: UPDATING,v 1.261 2015/04/04 12:15:38 martin Exp $
 
 This file (UPDATING) is intended to be a brief reference to recent
 changes that might cause problems in the build process, and a guide for
@@ -19,6 +19,12 @@ See also: BUILDING, build.sh, Makefile.
 Recent changes:
 ^^^
 
+20150404:
+	Lint changes require a full rebuild of the tool, so make
+	sure to build without -u option to build.sh, or manually
+	do a make cleandir in src/tools/lint1 and
+	src/usr.bin/xlint.
+
 20150310:
 	Improvements to openssl for arm mean that update builds of
 	the openssl libraries will fail. A make cleandir in



CVS commit: src

2015-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  4 12:15:38 UTC 2015

Modified Files:
src: UPDATING

Log Message:
Note required cleandir for lint changes


To generate a diff of this commit:
cvs rdiff -u -r1.260 -r1.261 src/UPDATING

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



CVS commit: src/sys/arch/mips

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 12:28:52 UTC 2015

Modified Files:
src/sys/arch/mips/conf: files.ingenic
Added Files:
src/sys/arch/mips/ingenic: jziic.c

Log Message:
preliminary driver for JZ4780's on-chip SMBus controllers
needs more work but it's good enough for talking to an RTC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/conf/files.ingenic
cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/ingenic/jziic.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/mips/conf/files.ingenic
diff -u src/sys/arch/mips/conf/files.ingenic:1.4 src/sys/arch/mips/conf/files.ingenic:1.5
--- src/sys/arch/mips/conf/files.ingenic:1.4	Tue Mar 10 18:16:20 2015
+++ src/sys/arch/mips/conf/files.ingenic	Sat Apr  4 12:28:52 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: files.ingenic,v 1.4 2015/03/10 18:16:20 macallan Exp $
+#	$NetBSD: files.ingenic,v 1.5 2015/04/04 12:28:52 macallan Exp $
 
 include dev/scsipi/files.scsipi		# SCSI devices
 include dev/ata/files.ata			# ATA devices
@@ -26,3 +26,9 @@ file	arch/mips/ingenic/ingenic_ehci.c	in
 # Ethernet
 attach dme at apbus with ingenic_dme
 file	arch/mips/ingenic/ingenic_dme.c		ingenic_dme	needs-flag
+
+# I2C
+device 	jziic : i2cbus
+attach 	jziic at apbus
+file 	arch/mips/ingenic/jziic.c	jziic
+defflag	opt_ingenic.h	JZIIC_DEBUG

Added files:

Index: src/sys/arch/mips/ingenic/jziic.c
diff -u /dev/null src/sys/arch/mips/ingenic/jziic.c:1.1
--- /dev/null	Sat Apr  4 12:28:52 2015
+++ src/sys/arch/mips/ingenic/jziic.c	Sat Apr  4 12:28:52 2015
@@ -0,0 +1,380 @@
+/*	$NetBSD: jziic.c,v 1.1 2015/04/04 12:28:52 macallan Exp $ */
+
+/*-
+ * Copyright (c) 2015 Michael Lorenz
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: jziic.c,v 1.1 2015/04/04 12:28:52 macallan Exp $);
+
+/*
+ * a preliminary driver for JZ4780's on-chip SMBus controllers
+ * - needs more error handling and interrupt support
+ * - transfers can't be more than the chip's FIFO, supposedly 16 bytes per 
+ *   direction
+ * so, good enough for RTCs but not much else yet
+ */
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/device.h
+#include sys/mutex.h
+#include sys/bus.h
+#include sys/mutex.h
+
+#include mips/ingenic/ingenic_var.h
+#include mips/ingenic/ingenic_regs.h
+
+#include dev/i2c/i2cvar.h
+
+#include opt_ingenic.h
+
+#ifdef JZIIC_DEBUG
+#define DPRINTF aprint_error
+#else
+#define DPRINTF while (0) printf
+#endif
+static int jziic_match(device_t, struct cfdata *, void *);
+static void jziic_attach(device_t, device_t, void *);
+
+struct jziic_softc {
+	device_t 		sc_dev;
+	bus_space_tag_t 	sc_memt;
+	bus_space_handle_t 	sc_memh;
+	struct i2c_controller 	sc_i2c;
+	kmutex_t		sc_buslock;
+	uint32_t		sc_pclk;
+};
+
+CFATTACH_DECL_NEW(jziic, sizeof(struct jziic_softc),
+jziic_match, jziic_attach, NULL, NULL);
+
+static int jziic_enable(struct jziic_softc *);
+static void jziic_disable(struct jziic_softc *);
+static int jziic_i2c_acquire_bus(void *, int);
+static void jziic_i2c_release_bus(void *, int);
+static int jziic_i2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
+		void *, size_t, int);
+
+
+/* ARGSUSED */
+static int
+jziic_match(device_t parent, struct cfdata *match, void *aux)
+{
+	struct apbus_attach_args *aa = aux;
+
+	if (strcmp(aa-aa_name, jziic) != 0)
+		return 0;
+
+	return 1;
+}
+
+/* ARGSUSED */
+static void
+jziic_attach(device_t parent, device_t self, void *aux)
+{
+	struct jziic_softc *sc = device_private(self);
+	struct apbus_attach_args *aa = aux;
+	struct 

CVS commit: src/sys/arch/mips

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 12:28:52 UTC 2015

Modified Files:
src/sys/arch/mips/conf: files.ingenic
Added Files:
src/sys/arch/mips/ingenic: jziic.c

Log Message:
preliminary driver for JZ4780's on-chip SMBus controllers
needs more work but it's good enough for talking to an RTC


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/conf/files.ingenic
cvs rdiff -u -r0 -r1.1 src/sys/arch/mips/ingenic/jziic.c

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



CVS commit: src/sys/arch/evbmips/ingenic

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 13:06:01 UTC 2015

Modified Files:
src/sys/arch/evbmips/ingenic: intr.c machdep.c mainbus.c

Log Message:
add IPI support
compile-tested only since we don't actually spin up the 2nd core yet


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/ingenic/intr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/ingenic/machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbmips/ingenic/mainbus.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/evbmips/ingenic/intr.c
diff -u src/sys/arch/evbmips/ingenic/intr.c:1.8 src/sys/arch/evbmips/ingenic/intr.c:1.9
--- src/sys/arch/evbmips/ingenic/intr.c:1.8	Sat Mar 28 16:57:23 2015
+++ src/sys/arch/evbmips/ingenic/intr.c	Sat Apr  4 13:06:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intr.c,v 1.8 2015/03/28 16:57:23 macallan Exp $ */
+/*	$NetBSD: intr.c,v 1.9 2015/04/04 13:06:01 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.8 2015/03/28 16:57:23 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: intr.c,v 1.9 2015/04/04 13:06:01 macallan Exp $);
 
 #define __INTR_PRIVATE
 
@@ -121,7 +121,7 @@ evbmips_intr_init(void)
 	/* allow peripheral interrupts to core 0 only */
 	reg = MFC0(12, 4);	/* reset entry and interrupts */
 	reg = 0x;
-	reg |= REIM_IRQ0_M | REIM_MIRQ0_M | REIM_MIRQ1_M;
+	reg |= REIM_IRQ0_M | REIM_MIRQ0_M;
 	MTC0(reg, 12, 4);
 }
 
@@ -149,7 +149,6 @@ evbmips_iointr(int ipl, vaddr_t pc, uint
 	if (ipending  MIPS_INT_MASK_1) {
 		/*
 		 * this is a mailbox interrupt / IPI
-		 * for now just print the message and clear it
 		 */
 		uint32_t reg;
 
@@ -157,26 +156,34 @@ evbmips_iointr(int ipl, vaddr_t pc, uint
 		reg = MFC0(12, 3);
 		if (id == 0) {
 			if (reg  CS_MIRQ0_P) {
+#ifdef MULTIPROCESSOR
+uint32_t tag;
+tag = MFC0(CP0_CORE_MBOX, 0);
 	
+ipi_process(curcpu(), tag);
 #ifdef INGENIC_INTR_DEBUG
 snprintf(buffer, 256,
-IPI for core 0, msg %08x\n,
-MFC0(CP0_CORE_MBOX, 0));
+IPI for core 0, msg %08x\n, tag);
 ingenic_puts(buffer);
 #endif
+#endif
 reg = (~CS_MIRQ0_P);
 /* clear it */
 MTC0(reg, 12, 3);
 			}
 		} else if (id == 1) {
 			if (reg  CS_MIRQ1_P) {
+#ifdef MULTIPROCESSOR
+uint32_t tag;
+tag = MFC0(CP0_CORE_MBOX, 1);
+ipi_process(curcpu(), tag);
 #ifdef INGENIC_INTR_DEBUG
 snprintf(buffer, 256,
-IPI for core 1, msg %08x\n,
-MFC0(CP0_CORE_MBOX, 1));
+IPI for core 1, msg %08x\n, tag);
 ingenic_puts(buffer);
 #endif
-reg = ( 7 - CS_MIRQ1_P);
+#endif
+reg = (~CS_MIRQ1_P);
 /* clear it */
 MTC0(reg, 12, 3);
 			}

Index: src/sys/arch/evbmips/ingenic/machdep.c
diff -u src/sys/arch/evbmips/ingenic/machdep.c:1.5 src/sys/arch/evbmips/ingenic/machdep.c:1.6
--- src/sys/arch/evbmips/ingenic/machdep.c:1.5	Tue Mar 10 22:39:38 2015
+++ src/sys/arch/evbmips/ingenic/machdep.c	Sat Apr  4 13:06:01 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.5 2015/03/10 22:39:38 macallan Exp $ */
+/*	$NetBSD: machdep.c,v 1.6 2015/04/04 13:06:01 macallan Exp $ */
 
 /*-
  * Copyright (c) 2014 Michael Lorenz
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.5 2015/03/10 22:39:38 macallan Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.6 2015/04/04 13:06:01 macallan Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -115,6 +115,40 @@ cal_timer(void)
 	do {} while (junk == readreg(JZ_OST_CNT_LO));
 }
 
+#ifdef MULTIPROCESSOR
+static void
+ingenic_cpu_init(struct cpu_info *ci)
+{
+	uint32_t reg;
+
+	/* enable IPIs for this core */
+	reg = MFC0(12, 4);	/* reset entry and interrupts */
+	reg = 0x;
+	if (cpu_index(ci) == 1) {
+		reg |= REIM_MIRQ1_M;
+	} else
+		reg |= REIM_MIRQ0_M;
+	MTC0(reg, 12, 4);
+}
+
+static int
+ingenic_send_ipi(struct cpu_info *ci, int tag)
+{
+	uint32_t msg;
+
+	msg = 1  tag;
+
+	if (cpus_running  (1  cpu_index(ci))) {
+		if (cpu_index(ci) == 0) {
+			MTC0(msg, CP0_CORE_MBOX, 0);
+		} else {
+			MTC0(msg, CP0_CORE_MBOX, 1);
+		}
+	}
+	return 0;
+}
+#endif
+
 void
 mach_init(void)
 {
@@ -154,7 +188,11 @@ mach_init(void)
 	printf(Memory size: 0x%08x\n, memsize);
 	physmem = btoc(memsize);
 
-	/* XXX this is CI20 specific */
+	/*
+	 * memory is at 0x2000 with first 256MB mirrored to 0x so
+	 * we can see them through KSEG*
+	 * assume 1GB for now, the SoC can theoretically support up to 3GB
+	 */
 	mem_clusters[0].start = PAGE_SIZE;
 	mem_clusters[0].size = 0x1000 - PAGE_SIZE;
 	mem_clusters[1].start = 0x3000;
@@ -182,6 +220,11 @@ mach_init(void)
 	 */
 	mips_init_lwp0_uarea();
 
+#ifdef MULTIPROCESSOR
+	mips_locoresw.lsw_send_ipi = ingenic_send_ipi;
+	mips_locoresw.lsw_cpu_init = ingenic_cpu_init;
+#endif
+
 	apbus_init();
 	/*
 	 * Initialize debuggers, and break into them, if 

CVS commit: src/sys/arch/evbmips/ingenic

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 13:06:01 UTC 2015

Modified Files:
src/sys/arch/evbmips/ingenic: intr.c machdep.c mainbus.c

Log Message:
add IPI support
compile-tested only since we don't actually spin up the 2nd core yet


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbmips/ingenic/intr.c
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/evbmips/ingenic/machdep.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbmips/ingenic/mainbus.c

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



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

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 14:12:40 UTC 2015

Modified Files:
src/sys/arch/sgimips/dev: scn.c

Log Message:
don't malloc a tiny, fixed size buffer to scribble into, then not use it
and never free it either

found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/dev/scn.c

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



CVS commit: src/sys/dev/i2c

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:14:42 UTC 2015

Modified Files:
src/sys/dev/i2c: i2c.c

Log Message:
Free cmd on error if we allocated it.

Found by Brainy, reported by maxv@.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/i2c/i2c.c

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



CVS commit: src/sys/dev/i2c

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:16:54 UTC 2015

Modified Files:
src/sys/dev/i2c: i2c.c

Log Message:
dedup code.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/i2c/i2c.c

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



CVS commit: src/sys/dev/i2c

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:14:42 UTC 2015

Modified Files:
src/sys/dev/i2c: i2c.c

Log Message:
Free cmd on error if we allocated it.

Found by Brainy, reported by maxv@.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/i2c/i2c.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/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.46 src/sys/dev/i2c/i2c.c:1.47
--- src/sys/dev/i2c/i2c.c:1.46	Thu Jan 22 17:56:35 2015
+++ src/sys/dev/i2c/i2c.c	Sat Apr  4 15:14:42 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.46 2015/01/22 17:56:35 jakllsch Exp $	*/
+/*	$NetBSD: i2c.c,v 1.47 2015/04/04 15:14:42 riastradh Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i2c.c,v 1.46 2015/01/22 17:56:35 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: i2c.c,v 1.47 2015/04/04 15:14:42 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -528,6 +528,8 @@ iic_ioctl_exec(struct iic_softc *sc, i2c
 	if (iie-iie_buf != NULL  I2C_OP_WRITE_P(iie-iie_op)) {
 		error = copyin(iie-iie_buf, buf, iie-iie_buflen);
 		if (error) {
+			if (cmd)
+kmem_free(cmd, iie-iie_cmdlen);
 			return error;
 		}
 	}



Re: CVS commit: src

2015-04-04 Thread Christos Zoulas
On Apr 4,  4:59pm, mar...@duskware.de (Martin Husemann) wrote:
-- Subject: Re: CVS commit: src

| On Sat, Apr 04, 2015 at 10:58:52AM -0400, Christos Zoulas wrote:
|  | lint1/cgram.c did not get regenerated for me.
|  
|  The tool, the program or both?
| 
| build.sh failed early in tools/lint1.

Are you sure you are not seeing a clock issue?

[11:48am] 2504#cd /usr/src/tools/lint1
[11:48am] 2505#make
[11:48am] 2506#touch /usr/src/usr.bin/xlint/lint1/cgram.y 
[11:48am] 2507#make
#  yacc  lint1/cgram.c
/usr/tools/amd64/bin/nbyacc -d -o cgram.c 
/usr/src/tools/lint1/../../usr.bin/xlint/lint1/cgram.y
/usr/tools/amd64/bin/nbyacc: 78 shift/reduce conflicts.
echo '#if HAVE_NBTOOL_CONFIG_H'  cgram.c.1
echo '#include nbtool_config.h'  cgram.c.1
echo '#endif'  cgram.c.1
cat cgram.c  cgram.c.1
mv cgram.c.1 cgram.c
#   compile  lint1/cgram.lo



christos


CVS commit: src/crypto/external/bsd/openssh/dist

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 13:59:20 UTC 2015

Modified Files:
src/crypto/external/bsd/openssh/dist: ssh-keyscan.c

Log Message:
Alpha is the only platform where sig_atomic_t isn't int...
OpenBSD does not compile OpenSSH on the alpha anymore?


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/crypto/external/bsd/openssh/dist/ssh-keyscan.c

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

Modified files:

Index: src/crypto/external/bsd/openssh/dist/ssh-keyscan.c
diff -u src/crypto/external/bsd/openssh/dist/ssh-keyscan.c:1.11 src/crypto/external/bsd/openssh/dist/ssh-keyscan.c:1.12
--- src/crypto/external/bsd/openssh/dist/ssh-keyscan.c:1.11	Fri Apr  3 19:58:19 2015
+++ src/crypto/external/bsd/openssh/dist/ssh-keyscan.c	Sat Apr  4 09:59:20 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: ssh-keyscan.c,v 1.11 2015/04/03 23:58:19 christos Exp $	*/
+/*	$NetBSD: ssh-keyscan.c,v 1.12 2015/04/04 13:59:20 christos Exp $	*/
 /* $OpenBSD: ssh-keyscan.c,v 1.99 2015/01/30 10:44:49 djm Exp $ */
 /*
  * Copyright 1995, 1996 by David Mazieres d...@lcs.mit.edu.
@@ -9,7 +9,7 @@
  */
 
 #include includes.h
-__RCSID($NetBSD: ssh-keyscan.c,v 1.11 2015/04/03 23:58:19 christos Exp $);
+__RCSID($NetBSD: ssh-keyscan.c,v 1.12 2015/04/04 13:59:20 christos Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -91,7 +91,7 @@ typedef struct Connection {
 	int c_len;		/* Total bytes which must be read. */
 	int c_off;		/* Length of data read so far. */
 	int c_keytype;		/* Only one of KT_RSA1, KT_DSA, or KT_RSA */
-	int c_done;		/* SSH2 done */
+	sig_atomic_t c_done;	/* SSH2 done */
 	char *c_namebase;	/* Address to free for c_name and c_namelist */
 	char *c_name;		/* Hostname of connection for errors */
 	char *c_namelist;	/* Pointer to other possible addresses */



CVS commit: src/crypto/external/bsd/openssh/dist

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 13:59:20 UTC 2015

Modified Files:
src/crypto/external/bsd/openssh/dist: ssh-keyscan.c

Log Message:
Alpha is the only platform where sig_atomic_t isn't int...
OpenBSD does not compile OpenSSH on the alpha anymore?


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/crypto/external/bsd/openssh/dist/ssh-keyscan.c

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



CVS commit: src/sys/arch/sgimips/mace

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 14:19:00 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: macekbc.c

Log Message:
malloc() - kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason

found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/mace/macekbc.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/sgimips/mace/macekbc.c
diff -u src/sys/arch/sgimips/mace/macekbc.c:1.7 src/sys/arch/sgimips/mace/macekbc.c:1.8
--- src/sys/arch/sgimips/mace/macekbc.c:1.7	Sat Oct 27 17:18:10 2012
+++ src/sys/arch/sgimips/mace/macekbc.c	Sat Apr  4 14:19:00 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: macekbc.c,v 1.7 2012/10/27 17:18:10 chs Exp $ */
+/* $NetBSD: macekbc.c,v 1.8 2015/04/04 14:19:00 macallan Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill jmcne...@invisible.ca
@@ -31,12 +31,12 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: macekbc.c,v 1.7 2012/10/27 17:18:10 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: macekbc.c,v 1.8 2015/04/04 14:19:00 macallan Exp $);
 
 #include sys/param.h
 #include sys/device.h
 #include sys/syslog.h
-#include sys/malloc.h
+#include sys/kmem.h
 
 #include sys/bus.h
 #include machine/intr.h
@@ -125,7 +125,7 @@ macekbc_attach(device_t parent, device_t
 	aprint_normal(: PS2 controller\n);
 	aprint_naive(\n);
 
-	t = malloc(sizeof(struct macekbc_internal), M_DEVBUF, M_NOWAIT|M_ZERO);
+	t = kmem_alloc(sizeof(struct macekbc_internal), KM_NOSLEEP);
 	if (t == NULL) {
 		aprint_error(%s: not enough memory\n, device_xname(self));
 		return;
@@ -137,20 +137,20 @@ macekbc_attach(device_t parent, device_t
 	0, t-t_ioh[PCKBPORT_KBD_SLOT]) != 0) {
 		aprint_error(%s: couldn't map kbd registers\n,
 		device_xname(self));
-		return;
+		goto bork;
 	}
 	if (bus_space_subregion(t-t_iot, maa-maa_sh, maa-maa_offset + 32,
 	0, t-t_ioh[PCKBPORT_AUX_SLOT]) != 0) {
 		aprint_error(%s: couldn't map aux registers\n,
 		device_xname(self));
-		return;
+		goto bork;
 	}
 
 	if ((t-t_rxih = cpu_intr_establish(maa-maa_intr, maa-maa_intrmask,
 	macekbc_intr, t)) == NULL) {
 		printf(%s: couldn't establish interrupt\n,
 		device_xname(self));
-		return;
+		goto bork;
 	}
 	sc-sc_id = t;
 	t-t_sc = sc;
@@ -169,6 +169,9 @@ macekbc_attach(device_t parent, device_t
 		t-t_present[PCKBPORT_AUX_SLOT] = 1;
 
 	return;
+bork:
+	kmem_free(t, sizeof(struct macekbc_internal));
+	return;
 }
 
 static int



CVS commit: src/sys/arch/sgimips/mace

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 14:19:00 UTC 2015

Modified Files:
src/sys/arch/sgimips/mace: macekbc.c

Log Message:
malloc() - kmem_alloc() for private data, also kmem_free() them if we
don't finish attaching for whatever reason

found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/mace/macekbc.c

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



Re: CVS commit: src

2015-04-04 Thread Martin Husemann
On Sat, Apr 04, 2015 at 02:02:44PM +, Christos Zoulas wrote:
 This indicates some broken dependencies, and should not be needed...
 Let's investigate more?

lint1/cgram.c did not get regenerated for me.

Martin


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

2015-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  4 14:56:48 UTC 2015

Modified Files:
src/sys/net [netbsd-7]: if_vlan.c

Log Message:
Pull up following revision(s) (requested by ozaki-r in ticket #653):
sys/net/if_vlan.c: revision 1.80
Correct frame padding length
vlan pads a frame with zeros up to 68 bytes
(ETHER_MIN_LEN + ETHER_VLAN_ENCAP_LEN). It expects
that even if the frame is untagged, it keeps 64 bytes
at least. However, it lacks concern about CRC
(4 bytes). So a sending frame can be 72 (68 + 4) bytes.
PR 49788


To generate a diff of this commit:
cvs rdiff -u -r1.70.2.1 -r1.70.2.2 src/sys/net/if_vlan.c

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



CVS commit: src/sys/external/bsd/drm2

2015-04-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr  4 15:12:39 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c
src/sys/external/bsd/drm2/nouveau: nouveaufb.c

Log Message:
pmf_device_register returns false on failure, not true


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/i915drm/intelfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/nouveau/nouveaufb.c

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

Modified files:

Index: src/sys/external/bsd/drm2/i915drm/intelfb.c
diff -u src/sys/external/bsd/drm2/i915drm/intelfb.c:1.12 src/sys/external/bsd/drm2/i915drm/intelfb.c:1.13
--- src/sys/external/bsd/drm2/i915drm/intelfb.c:1.12	Thu Mar  5 17:56:39 2015
+++ src/sys/external/bsd/drm2/i915drm/intelfb.c	Sat Apr  4 15:12:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: intelfb.c,v 1.12 2015/03/05 17:56:39 riastradh Exp $	*/
+/*	$NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2014 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: intelfb.c,v 1.12 2015/03/05 17:56:39 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: intelfb.c,v 1.13 2015/04/04 15:12:39 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/bus.h
@@ -180,7 +180,7 @@ intelfb_attach_task(struct i915drmkms_ta
 		return;
 	}
 
-	if (pmf_device_register1(sc-sc_dev, NULL, NULL, intelfb_shutdown))
+	if (!pmf_device_register1(sc-sc_dev, NULL, NULL, intelfb_shutdown))
 		aprint_error_dev(sc-sc_dev,
 		failed to register shutdown handler\n);
 

Index: src/sys/external/bsd/drm2/nouveau/nouveaufb.c
diff -u src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.1 src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.2
--- src/sys/external/bsd/drm2/nouveau/nouveaufb.c:1.1	Fri Mar  6 01:43:07 2015
+++ src/sys/external/bsd/drm2/nouveau/nouveaufb.c	Sat Apr  4 15:12:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: nouveaufb.c,v 1.1 2015/03/06 01:43:07 riastradh Exp $	*/
+/*	$NetBSD: nouveaufb.c,v 1.2 2015/04/04 15:12:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2015 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: nouveaufb.c,v 1.1 2015/03/06 01:43:07 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: nouveaufb.c,v 1.2 2015/04/04 15:12:39 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/bus.h
@@ -158,7 +158,7 @@ nouveaufb_attach_task(struct nouveau_tas
 		return;
 	}
 
-	if (pmf_device_register1(sc-sc_dev, NULL, NULL, nouveaufb_shutdown))
+	if (!pmf_device_register1(sc-sc_dev, NULL, NULL, nouveaufb_shutdown))
 		aprint_error_dev(sc-sc_dev,
 		failed to register shutdown handler\n);
 



CVS commit: src/sys/external/bsd/drm2

2015-04-04 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Sat Apr  4 15:12:39 UTC 2015

Modified Files:
src/sys/external/bsd/drm2/i915drm: intelfb.c
src/sys/external/bsd/drm2/nouveau: nouveaufb.c

Log Message:
pmf_device_register returns false on failure, not true


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/external/bsd/drm2/i915drm/intelfb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/external/bsd/drm2/nouveau/nouveaufb.c

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



CVS commit: src/sys/dev/sysmon

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:25:16 UTC 2015

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
Free ped if we can't hand it to the power daemon.

Found by Brainy, reported by maxv@.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/sysmon/sysmon_power.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_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.49 src/sys/dev/sysmon/sysmon_power.c:1.50
--- src/sys/dev/sysmon/sysmon_power.c:1.49	Tue Jan  6 15:39:54 2015
+++ src/sys/dev/sysmon/sysmon_power.c	Sat Apr  4 15:25:16 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_power.c,v 1.49 2015/01/06 15:39:54 bouyer Exp $	*/
+/*	$NetBSD: sysmon_power.c,v 1.50 2015/04/04 15:25:16 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysmon_power.c,v 1.49 2015/01/06 15:39:54 bouyer Exp $);
+__KERNEL_RCSID(0, $NetBSD: sysmon_power.c,v 1.50 2015/04/04 15:25:16 riastradh Exp $);
 
 #include opt_compat_netbsd.h
 #include sys/param.h
@@ -800,6 +800,7 @@ sysmon_penvsys_event(struct penvsys_stat
 
 		if (sysmon_power_daemon_task(ped, pes, event) == 0)
 			return;
+		kmem_free(ped, sizeof(*ped));
 	}
 
 	switch (pes-pes_type) {
@@ -954,6 +955,7 @@ sysmon_pswitch_event(struct sysmon_pswit
 
 		if (sysmon_power_daemon_task(ped, smpsw, event) == 0)
 			return;
+		kmem_free(ped, sizeof(*ped));
 	}
 	
 	switch (smpsw-smpsw_type) {



CVS commit: src/sys/dev/sysmon

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:25:16 UTC 2015

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
Free ped if we can't hand it to the power daemon.

Found by Brainy, reported by maxv@.


To generate a diff of this commit:
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/sysmon/sysmon_power.c

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



CVS commit: src/sys/dev/usb

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:33:36 UTC 2015

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

Log Message:
fix leak, found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/umass_isdata.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/umass_isdata.c
diff -u src/sys/dev/usb/umass_isdata.c:1.30 src/sys/dev/usb/umass_isdata.c:1.31
--- src/sys/dev/usb/umass_isdata.c:1.30	Fri Sep 12 12:40:38 2014
+++ src/sys/dev/usb/umass_isdata.c	Sat Apr  4 11:33:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: umass_isdata.c,v 1.30 2014/09/12 16:40:38 skrll Exp $	*/
+/*	$NetBSD: umass_isdata.c,v 1.31 2015/04/04 15:33:36 christos Exp $	*/
 
 /*
  * TODO:
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umass_isdata.c,v 1.30 2014/09/12 16:40:38 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: umass_isdata.c,v 1.31 2015/04/04 15:33:36 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -195,8 +195,11 @@ umass_isdata_attach(struct umass_softc *
 	USETW(req.wLength, sizeof *cf);
 
 	err = usbd_do_request(sc-sc_udev, req, cf);
-	if (err)
-		return (EIO);
+	if (err) {
+		sc-bus = NULL;
+		free(scbus, M_DEVBUF);
+		return EIO;
+	}
 	DPRINTF((umass_wd_attach info:\n  EventNotification=0x%02x 
 		 ExternalClock=0x%02x ATAInitTimeout=0x%02x\n
 		   ATAMisc1=0x%02x ATAMajorCommand=0x%02x 



CVS commit: src/sys/dev/sysmon

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:31:17 UTC 2015

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
another missing free dict.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/sysmon/sysmon_power.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_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.51 src/sys/dev/sysmon/sysmon_power.c:1.52
--- src/sys/dev/sysmon/sysmon_power.c:1.51	Sat Apr  4 11:29:59 2015
+++ src/sys/dev/sysmon/sysmon_power.c	Sat Apr  4 11:31:17 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_power.c,v 1.51 2015/04/04 15:29:59 christos Exp $	*/
+/*	$NetBSD: sysmon_power.c,v 1.52 2015/04/04 15:31:17 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysmon_power.c,v 1.51 2015/04/04 15:29:59 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: sysmon_power.c,v 1.52 2015/04/04 15:31:17 christos Exp $);
 
 #include opt_compat_netbsd.h
 #include sys/param.h
@@ -957,6 +957,8 @@ sysmon_pswitch_event(struct sysmon_pswit
 
 		if (sysmon_power_daemon_task(ped, smpsw, event) == 0)
 			return;
+		/* We failed */
+		prop_object_release(ped-dict);
 		kmem_free(ped, sizeof(*ped));
 	}
 	



CVS commit: src/sys/dev/hpc

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:39:40 UTC 2015

Modified Files:
src/sys/dev/hpc: hpcfb.c

Log Message:
fix leak, found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/hpc/hpcfb.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/hpc/hpcfb.c
diff -u src/sys/dev/hpc/hpcfb.c:1.58 src/sys/dev/hpc/hpcfb.c:1.59
--- src/sys/dev/hpc/hpcfb.c:1.58	Sat Nov 13 08:51:59 2010
+++ src/sys/dev/hpc/hpcfb.c	Sat Apr  4 11:39:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: hpcfb.c,v 1.58 2010/11/13 13:51:59 uebayasi Exp $	*/
+/*	$NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $	*/
 
 /*-
  * Copyright (c) 1999
@@ -43,7 +43,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.58 2010/11/13 13:51:59 uebayasi Exp $);
+__KERNEL_RCSID(0, $NetBSD: hpcfb.c,v 1.59 2015/04/04 15:39:40 christos Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_hpcfb.h
@@ -472,7 +472,8 @@ hpcfb_init(struct hpcfb_fbconf *fbconf,	
 	}
 
 	if (rasops_init(ri, HPCFB_MAX_ROW, HPCFB_MAX_COLUMN)) {
-		panic(%s(%d): rasops_init() failed!, __FILE__, __LINE__);
+		aprint_error_dev(dc-dc_sc-sc_dev, rasops_init() failed!)
+		return -1;
 	}
 
 	/* over write color map of rasops */
@@ -722,13 +723,15 @@ hpcfb_alloc_screen(void *v, const struct
 
 	DPRINTF((%s(%d): hpcfb_alloc_screen()\n, __FILE__, __LINE__));
 
-	dc = malloc(sizeof(struct hpcfb_devconfig), M_DEVBUF, M_WAITOK|M_ZERO);
+	dc = malloc(sizeof(*dc), M_DEVBUF, M_WAITOK|M_ZERO);
 	if (dc == NULL)
-		return (ENOMEM);
+		return ENOMEM;
 
 	dc-dc_sc = sc;
-	if (hpcfb_init(sc-sc_fbconflist[0], dc) != 0)
-		return (EINVAL);
+	if (hpcfb_init(sc-sc_fbconflist[0], dc) != 0) {
+		free(dc, M_DEVBUF);
+		return EINVAL;
+	}
 	if (sc-sc_accessops-font) {
 		sc-sc_accessops-font(sc-sc_accessctx,
 		dc-dc_rinfo.ri_font);



CVS commit: src/sys/dev/hpc

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:39:40 UTC 2015

Modified Files:
src/sys/dev/hpc: hpcfb.c

Log Message:
fix leak, found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/hpc/hpcfb.c

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



CVS commit: src

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 12:34:45 UTC 2015

Modified Files:
src/sys/fs/msdosfs: msdosfs_vnops.c
src/sys/fs/sysvbfs: sysvbfs_vnops.c
src/sys/fs/udf: udf_vnops.c
src/tests/fs/vfs: t_io.c

Log Message:
Fix remaining read(fd, NULL, 1) cases.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.56 -r1.57 src/sys/fs/sysvbfs/sysvbfs_vnops.c
cvs rdiff -u -r1.97 -r1.98 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/vfs/t_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/fs/msdosfs/msdosfs_vnops.c
diff -u src/sys/fs/msdosfs/msdosfs_vnops.c:1.92 src/sys/fs/msdosfs/msdosfs_vnops.c:1.93
--- src/sys/fs/msdosfs/msdosfs_vnops.c:1.92	Sat Mar 28 19:24:05 2015
+++ src/sys/fs/msdosfs/msdosfs_vnops.c	Sat Apr  4 12:34:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: msdosfs_vnops.c,v 1.92 2015/03/28 19:24:05 maxv Exp $	*/
+/*	$NetBSD: msdosfs_vnops.c,v 1.93 2015/04/04 12:34:44 riastradh Exp $	*/
 
 /*-
  * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -48,7 +48,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.92 2015/03/28 19:24:05 maxv Exp $);
+__KERNEL_RCSID(0, $NetBSD: msdosfs_vnops.c,v 1.93 2015/04/04 12:34:44 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -532,8 +532,13 @@ msdosfs_read(void *v)
 	} while (error == 0  uio-uio_resid  0  n != 0);
 
 out:
-	if ((ap-a_ioflag  IO_SYNC) == IO_SYNC)
-		error = deupdat(dep, 1);
+	if ((ap-a_ioflag  IO_SYNC) == IO_SYNC) {
+		int uerror;
+
+		uerror = deupdat(dep, 1);
+		if (error == 0)
+			error = uerror;
+	}
 bad:
 	fstrans_done(vp-v_mount);
 	return (error);

Index: src/sys/fs/sysvbfs/sysvbfs_vnops.c
diff -u src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.56 src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.57
--- src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.56	Fri Dec 26 15:23:21 2014
+++ src/sys/fs/sysvbfs/sysvbfs_vnops.c	Sat Apr  4 12:34:45 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs_vnops.c,v 1.56 2014/12/26 15:23:21 hannken Exp $	*/
+/*	$NetBSD: sysvbfs_vnops.c,v 1.57 2015/04/04 12:34:45 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.56 2014/12/26 15:23:21 hannken Exp $);
+__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.57 2015/04/04 12:34:45 riastradh Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -426,7 +426,7 @@ sysvbfs_read(void *arg)
 	struct sysvbfs_node *bnode = v-v_data;
 	struct bfs_inode *inode = bnode-inode;
 	vsize_t sz, filesz = bfs_file_size(inode);
-	int err;
+	int err, uerr;
 	const int advice = IO_ADV_DECODE(a-a_ioflag);
 
 	DPRINTF(%s: type=%d\n, __func__, v-v_type);
@@ -450,7 +450,11 @@ sysvbfs_read(void *arg)
 		DPRINTF(%s: read %ldbyte\n, __func__, sz);
 	}
 
-	return sysvbfs_update(v, NULL, NULL, UPDATE_WAIT);
+	uerr = sysvbfs_update(v, NULL, NULL, UPDATE_WAIT);
+	if (err == 0)
+		err = uerr;
+
+	return err;
 }
 
 int

Index: src/sys/fs/udf/udf_vnops.c
diff -u src/sys/fs/udf/udf_vnops.c:1.97 src/sys/fs/udf/udf_vnops.c:1.98
--- src/sys/fs/udf/udf_vnops.c:1.97	Wed Jan 28 14:00:58 2015
+++ src/sys/fs/udf/udf_vnops.c	Sat Apr  4 12:34:45 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: udf_vnops.c,v 1.97 2015/01/28 14:00:58 martin Exp $ */
+/* $NetBSD: udf_vnops.c,v 1.98 2015/04/04 12:34:45 riastradh Exp $ */
 
 /*
  * Copyright (c) 2006, 2008 Reinoud Zandijk
@@ -32,7 +32,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__KERNEL_RCSID(0, $NetBSD: udf_vnops.c,v 1.97 2015/01/28 14:00:58 martin Exp $);
+__KERNEL_RCSID(0, $NetBSD: udf_vnops.c,v 1.98 2015/04/04 12:34:45 riastradh Exp $);
 #endif /* not lint */
 
 
@@ -251,8 +251,13 @@ udf_read(void *v)
 	/* note access time unless not requested */
 	if (!(vp-v_mount-mnt_flag  MNT_NOATIME)) {
 		udf_node-i_flags |= IN_ACCESS;
-		if ((ioflag  IO_SYNC) == IO_SYNC)
-			error = udf_update(vp, NULL, NULL, NULL, UPDATE_WAIT);
+		if ((ioflag  IO_SYNC) == IO_SYNC) {
+			int uerror;
+
+			uerror = udf_update(vp, NULL, NULL, NULL, UPDATE_WAIT);
+			if (error == 0)
+error = uerror;
+		}
 	}
 
 	return error;

Index: src/tests/fs/vfs/t_io.c
diff -u src/tests/fs/vfs/t_io.c:1.15 src/tests/fs/vfs/t_io.c:1.16
--- src/tests/fs/vfs/t_io.c:1.15	Sat Mar 28 17:45:47 2015
+++ src/tests/fs/vfs/t_io.c	Sat Apr  4 12:34:44 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_io.c,v 1.15 2015/03/28 17:45:47 riastradh Exp $	*/
+/*	$NetBSD: t_io.c,v 1.16 2015/04/04 12:34:44 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -233,9 +233,6 @@ read_fault(const atf_tc_t *tc, const cha
 	ATF_REQUIRE_EQ(rump_sys_write(fd, ch, 1), 1);
 	RL(rump_sys_close(fd));
 	RL(fd = rump_sys_open(file, O_RDONLY | O_SYNC | O_RSYNC));
-	if (FSTYPE_MSDOS(tc) ||
-	FSTYPE_SYSVBFS(tc))
-		atf_tc_expect_fail(bad sync atime update code path);
 	

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

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 12:32:34 UTC 2015

Modified Files:
src/sys/arch/evbmips/conf: CI20

Log Message:
add jziic and RTC drivers


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbmips/conf/CI20

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



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

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 12:32:34 UTC 2015

Modified Files:
src/sys/arch/evbmips/conf: CI20

Log Message:
add jziic and RTC drivers


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/evbmips/conf/CI20

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/evbmips/conf/CI20
diff -u src/sys/arch/evbmips/conf/CI20:1.11 src/sys/arch/evbmips/conf/CI20:1.12
--- src/sys/arch/evbmips/conf/CI20:1.11	Tue Mar 17 07:28:18 2015
+++ src/sys/arch/evbmips/conf/CI20	Sat Apr  4 12:32:34 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: CI20,v 1.11 2015/03/17 07:28:18 macallan Exp $
+#	$NetBSD: CI20,v 1.12 2015/04/04 12:32:34 macallan Exp $
 #
 # MIPS Creator CI20
 #
@@ -7,7 +7,7 @@ include 	arch/evbmips/conf/std.ingenic
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		CI20-$Revision: 1.11 $
+#ident 		CI20-$Revision: 1.12 $
 
 maxusers	32
 
@@ -136,6 +136,7 @@ config		netbsd	root on sd0a type ffs
 #config		netbsd	root on axe0 type nfs
 
 mainbus0 	at root
+#options 	MULTIPROCESSOR
 cpu0 		at mainbus?
 #wdog0		at mainbus?
 com*		at mainbus?
@@ -156,11 +157,31 @@ usb* 		at ohci?
 # onboard ethernet
 dme*		at apbus?
 
+# I2C/SMBus
+# Work in progress - can't do transfers over 15 bytes per direction,
+# no interrupts etc.
+# Good enough for talking to an RTC though, so it's enabled.
+jziic* 		at apbus?
+#options 	JZIIC_DEBUG	# spammy
+iic* 		at jziic?
+
+# voltage control and the like, no driver yet
+#act8600pm0 	at iic0 addr 0x5a
+
+# XXX
+# the manual says there's a Pericom RTC at SMB4 addr 0x68
+# on my preproduction CI20 that's not the case, instead there's something that
+# looks like a PCF8563 at addr 0x51
+ 
+# the Pericom PT7C4337 seems to be a DS1339 clone
+#dsrtc0 	at iic4 addr 0x68 flags 1339
+
+# at least some CI20 have this instead
+pcf8563rtc0	at iic4 addr 0x51
+
 #jzgpio* 	at apbus? addr ?
 #gpio*		at jzgpio?
 
-# no RTC!  so fake with a stub (required to prevent evbmips panic)
-
 # USB stuff
 uhub*		at usb?
 uhub*		at uhub? port ?



CVS commit: src

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 12:34:45 UTC 2015

Modified Files:
src/sys/fs/msdosfs: msdosfs_vnops.c
src/sys/fs/sysvbfs: sysvbfs_vnops.c
src/sys/fs/udf: udf_vnops.c
src/tests/fs/vfs: t_io.c

Log Message:
Fix remaining read(fd, NULL, 1) cases.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/fs/msdosfs/msdosfs_vnops.c
cvs rdiff -u -r1.56 -r1.57 src/sys/fs/sysvbfs/sysvbfs_vnops.c
cvs rdiff -u -r1.97 -r1.98 src/sys/fs/udf/udf_vnops.c
cvs rdiff -u -r1.15 -r1.16 src/tests/fs/vfs/t_io.c

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



CVS commit: src/sys/fs/sysvbfs

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 13:28:36 UTC 2015

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vnops.c

Log Message:
Make sure err is initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/fs/sysvbfs/sysvbfs_vnops.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/sysvbfs/sysvbfs_vnops.c
diff -u src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.57 src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.58
--- src/sys/fs/sysvbfs/sysvbfs_vnops.c:1.57	Sat Apr  4 12:34:45 2015
+++ src/sys/fs/sysvbfs/sysvbfs_vnops.c	Sat Apr  4 13:28:36 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysvbfs_vnops.c,v 1.57 2015/04/04 12:34:45 riastradh Exp $	*/
+/*	$NetBSD: sysvbfs_vnops.c,v 1.58 2015/04/04 13:28:36 riastradh Exp $	*/
 
 /*-
  * Copyright (c) 2004 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.57 2015/04/04 12:34:45 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: sysvbfs_vnops.c,v 1.58 2015/04/04 13:28:36 riastradh Exp $);
 
 #include sys/param.h
 #include sys/kernel.h
@@ -439,6 +439,7 @@ sysvbfs_read(void *arg)
 		return EINVAL;
 	}
 
+	err = 0;
 	while (uio-uio_resid  0) {
 		if ((sz = MIN(filesz - uio-uio_offset, uio-uio_resid)) == 0)
 			break;



CVS commit: src/sys/fs/sysvbfs

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 13:28:36 UTC 2015

Modified Files:
src/sys/fs/sysvbfs: sysvbfs_vnops.c

Log Message:
Make sure err is initialized.


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/fs/sysvbfs/sysvbfs_vnops.c

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



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

2015-04-04 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Sat Apr  4 14:12:40 UTC 2015

Modified Files:
src/sys/arch/sgimips/dev: scn.c

Log Message:
don't malloc a tiny, fixed size buffer to scribble into, then not use it
and never free it either

found by Brainy


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/sgimips/dev/scn.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/sgimips/dev/scn.c
diff -u src/sys/arch/sgimips/dev/scn.c:1.7 src/sys/arch/sgimips/dev/scn.c:1.8
--- src/sys/arch/sgimips/dev/scn.c:1.7	Fri Jul 25 08:10:34 2014
+++ src/sys/arch/sgimips/dev/scn.c	Sat Apr  4 14:12:40 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: scn.c,v 1.7 2014/07/25 08:10:34 dholland Exp $ */
+/*	$NetBSD: scn.c,v 1.8 2015/04/04 14:12:40 macallan Exp $ */
 
 /*
  * Resurrected from the old pc532 port 1/18/2009.
@@ -92,7 +92,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: scn.c,v 1.7 2014/07/25 08:10:34 dholland Exp $);
+__KERNEL_RCSID(0, $NetBSD: scn.c,v 1.8 2015/04/04 14:12:40 macallan Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -815,7 +815,6 @@ scn_attach(device_t parent, device_t sel
 	u_char mr1, mr2;
 	enum scntype scntype = SCNUNK;
 	const char *duart_type = Unknown;
-	char *intrname;
 	bool console, first;
 	devmajor_t major;
 
@@ -906,9 +905,6 @@ scn_attach(device_t parent, device_t sel
 		ch_base[CH_MR] = mr2;
 		splx(s);
 
-		intrname = malloc(sizeof(scnXX), M_DEVBUF, M_NOWAIT);
-		snprintf(intrname, sizeof(scnXX), scn%d, unit);
-
 		/*
 		 * On IP6 the console chip is duart1. The keyboard/mouse
 		 * is duart0. Each chip has two channels and the channels



Re: CVS commit: src

2015-04-04 Thread Christos Zoulas
On Apr 4,  4:29pm, mar...@duskware.de (Martin Husemann) wrote:
-- Subject: Re: CVS commit: src

| On Sat, Apr 04, 2015 at 02:02:44PM +, Christos Zoulas wrote:
|  This indicates some broken dependencies, and should not be needed...
|  Let's investigate more?
| 
| lint1/cgram.c did not get regenerated for me.

The tool, the program or both?

christos


CVS commit: src/sys/dev/pci

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:08:40 UTC 2015

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

Log Message:
Fix error branches in agp_amd64.c.

- agp_generic_detach always.
- Free asc if it was allocated.  (Found by Brainy, noted by maxv@.)
- Free the GATT if it was allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/agp_amd64.c

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




CVS commit: src/sys/dev/pci

2015-04-04 Thread Taylor R Campbell
Module Name:src
Committed By:   riastradh
Date:   Sat Apr  4 15:08:40 UTC 2015

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

Log Message:
Fix error branches in agp_amd64.c.

- agp_generic_detach always.
- Free asc if it was allocated.  (Found by Brainy, noted by maxv@.)
- Free the GATT if it was allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/pci/agp_amd64.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/agp_amd64.c
diff -u src/sys/dev/pci/agp_amd64.c:1.7 src/sys/dev/pci/agp_amd64.c:1.8
--- src/sys/dev/pci/agp_amd64.c:1.7	Sat Feb 25 21:21:09 2012
+++ src/sys/dev/pci/agp_amd64.c	Sat Apr  4 15:08:40 2015
@@ -25,7 +25,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: agp_amd64.c,v 1.7 2012/02/25 21:21:09 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: agp_amd64.c,v 1.8 2015/04/04 15:08:40 riastradh Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -206,17 +206,19 @@ agp_amd64_attach(device_t parent, device
 	pcitag_t tag;
 	pcireg_t id, attbase, apctrl;
 	int maxdevs, i, n;
+	int error;
 
 	asc = malloc(sizeof(struct agp_amd64_softc), M_AGP, M_NOWAIT | M_ZERO);
 	if (asc == NULL) {
 		aprint_error(: can't allocate softc\n);
-		return ENOMEM;
+		error = ENOMEM;
+		goto fail0;
 	}
 
 	if (agp_map_aperture(pa, sc, AGP_APBASE) != 0) {
 		aprint_error(: can't map aperture\n);
-		free(asc, M_AGP);
-		return ENXIO;
+		error = ENXIO;
+		goto fail1;
 	}
 
 	maxdevs = pci_bus_maxdevs(pa-pa_pc, 0);
@@ -232,7 +234,8 @@ agp_amd64_attach(device_t parent, device
 	}
 	if (n == 0) {
 		aprint_error(: No Miscellaneous Control unit found.\n);
-		return ENXIO;
+		error = ENXIO;
+		goto fail1;
 	}
 	asc-n_mctrl = n;
 
@@ -256,8 +259,8 @@ agp_amd64_attach(device_t parent, device
 		 * aperture so that the gatt size reduces.
 		 */
 		if (AGP_SET_APERTURE(sc, AGP_GET_APERTURE(sc) / 2)) {
-			agp_generic_detach(sc);
-			return ENOMEM;
+			error = ENOMEM;
+			goto fail1;
 		}
 	}
 	asc-gatt = gatt;
@@ -265,15 +268,21 @@ agp_amd64_attach(device_t parent, device
 	switch (PCI_VENDOR(sc-as_id)) {
 	case PCI_VENDOR_ALI:
 		agp_amd64_uli_init(sc);
-		if (agp_amd64_uli_set_aperture(sc, asc-initial_aperture))
-			return ENXIO;
+		if (agp_amd64_uli_set_aperture(sc, asc-initial_aperture)) {
+			/* XXX Back out agp_amd64_uli_init?  */
+			error = ENXIO;
+			goto fail2;
+		}
 		break;
 
 	case PCI_VENDOR_NVIDIA:
 		asc-ctrl_tag = AGP_AMD64_NVIDIA_PCITAG(pa-pa_pc);
 		agp_amd64_nvidia_init(sc);
-		if (agp_amd64_nvidia_set_aperture(sc, asc-initial_aperture))
-			return ENXIO;
+		if (agp_amd64_nvidia_set_aperture(sc, asc-initial_aperture)) {
+			/* XXX Back out agp_amd64_nvidia_init?  */
+			error = ENXIO;
+			goto fail2;
+		}
 		break;
 
 	case PCI_VENDOR_VIATECH:
@@ -282,8 +291,11 @@ agp_amd64_attach(device_t parent, device
 			asc-ctrl_tag = AGP_AMD64_VIA_PCITAG(pa-pa_pc);
 			agp_amd64_via_init(sc);
 			if (agp_amd64_via_set_aperture(sc,
-			asc-initial_aperture))
-return ENXIO;
+			asc-initial_aperture)) {
+/* XXX Back out agp_amd64_via_init?  */
+error = ENXIO;
+goto fail2;
+			}
 		}
 		break;
 	}
@@ -304,7 +316,14 @@ agp_amd64_attach(device_t parent, device
 
 	agp_flush_cache();
 
+	/* Success!  */
 	return 0;
+
+fail2:	agp_free_gatt(sc, gatt);
+fail1:	free(asc, M_AGP);
+fail0:	agp_generic_detach(sc);
+	KASSERT(error);
+	return error;
 }
 
 



CVS commit: src/sys/dev/ic

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:09:45 UTC 2015

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

Log Message:
fix memory leak, found by Brainy.
XXX: is there anything else that we need to cleanup at this point?


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/ac97.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/ac97.c
diff -u src/sys/dev/ic/ac97.c:1.95 src/sys/dev/ic/ac97.c:1.96
--- src/sys/dev/ic/ac97.c:1.95	Sat Oct 27 13:18:18 2012
+++ src/sys/dev/ic/ac97.c	Sat Apr  4 11:09:45 2015
@@ -1,4 +1,4 @@
-/*  $NetBSD: ac97.c,v 1.95 2012/10/27 17:18:18 chs Exp $ */
+/*  $NetBSD: ac97.c,v 1.96 2015/04/04 15:09:45 christos Exp $ */
 /*	$OpenBSD: ac97.c,v 1.8 2000/07/19 09:01:35 csapuntz Exp $	*/
 
 /*
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ac97.c,v 1.95 2012/10/27 17:18:18 chs Exp $);
+__KERNEL_RCSID(0, $NetBSD: ac97.c,v 1.96 2015/04/04 15:09:45 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -1444,6 +1444,7 @@ ac97_attach_type(struct ac97_host_if *ho
 
 		if (as-ext_mid == 0 || as-ext_mid == 0x) {
 			aprint_normal_dev(sc_dev, no modem codec found\n);
+			free(as, M_DEVBUF);
 			return ENXIO;
 		}
 		as-type = AC97_CODEC_TYPE_MODEM;



CVS commit: src/sys/dev/ic

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:09:45 UTC 2015

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

Log Message:
fix memory leak, found by Brainy.
XXX: is there anything else that we need to cleanup at this point?


To generate a diff of this commit:
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/ic/ac97.c

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



CVS commit: src/sys/dev/i2c

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:16:54 UTC 2015

Modified Files:
src/sys/dev/i2c: i2c.c

Log Message:
dedup code.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/i2c/i2c.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/i2c/i2c.c
diff -u src/sys/dev/i2c/i2c.c:1.47 src/sys/dev/i2c/i2c.c:1.48
--- src/sys/dev/i2c/i2c.c:1.47	Sat Apr  4 11:14:42 2015
+++ src/sys/dev/i2c/i2c.c	Sat Apr  4 11:16:54 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: i2c.c,v 1.47 2015/04/04 15:14:42 riastradh Exp $	*/
+/*	$NetBSD: i2c.c,v 1.48 2015/04/04 15:16:54 christos Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
 #endif
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: i2c.c,v 1.47 2015/04/04 15:14:42 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: i2c.c,v 1.48 2015/04/04 15:16:54 christos Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -519,19 +519,14 @@ iic_ioctl_exec(struct iic_softc *sc, i2c
 		if (cmd == NULL)
 			return ENOMEM;
 		error = copyin(iie-iie_cmd, cmd, iie-iie_cmdlen);
-		if (error) {
-			kmem_free(cmd, iie-iie_cmdlen);
-			return error;
-		}
+		if (error)
+			goto out;
 	}
 
 	if (iie-iie_buf != NULL  I2C_OP_WRITE_P(iie-iie_op)) {
 		error = copyin(iie-iie_buf, buf, iie-iie_buflen);
-		if (error) {
-			if (cmd)
-kmem_free(cmd, iie-iie_cmdlen);
-			return error;
-		}
+		if (error)
+			goto out;
 	}
 
 	iic_acquire_bus(ic, 0);
@@ -545,6 +540,7 @@ iic_ioctl_exec(struct iic_softc *sc, i2c
 	if (error  0)
 		error = EIO;
 
+out:
 	if (cmd)
 		kmem_free(cmd, iie-iie_cmdlen);
 



CVS commit: src/sys/dev/sysmon

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:29:59 UTC 2015

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
don't forget to free the dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sysmon/sysmon_power.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_power.c
diff -u src/sys/dev/sysmon/sysmon_power.c:1.50 src/sys/dev/sysmon/sysmon_power.c:1.51
--- src/sys/dev/sysmon/sysmon_power.c:1.50	Sat Apr  4 11:25:16 2015
+++ src/sys/dev/sysmon/sysmon_power.c	Sat Apr  4 11:29:59 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_power.c,v 1.50 2015/04/04 15:25:16 riastradh Exp $	*/
+/*	$NetBSD: sysmon_power.c,v 1.51 2015/04/04 15:29:59 christos Exp $	*/
 
 /*-
  * Copyright (c) 2007 Juan Romero Pardines.
@@ -69,7 +69,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: sysmon_power.c,v 1.50 2015/04/04 15:25:16 riastradh Exp $);
+__KERNEL_RCSID(0, $NetBSD: sysmon_power.c,v 1.51 2015/04/04 15:29:59 christos Exp $);
 
 #include opt_compat_netbsd.h
 #include sys/param.h
@@ -800,6 +800,8 @@ sysmon_penvsys_event(struct penvsys_stat
 
 		if (sysmon_power_daemon_task(ped, pes, event) == 0)
 			return;
+		/* We failed */
+		prop_object_release(ped-dict);
 		kmem_free(ped, sizeof(*ped));
 	}
 



CVS commit: src/sys/dev/sysmon

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:29:59 UTC 2015

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
don't forget to free the dictionary.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/sysmon/sysmon_power.c

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



CVS commit: src/sys/dev/sysmon

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:31:17 UTC 2015

Modified Files:
src/sys/dev/sysmon: sysmon_power.c

Log Message:
another missing free dict.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/dev/sysmon/sysmon_power.c

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



CVS commit: src/sys/dev/usb

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 15:33:36 UTC 2015

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

Log Message:
fix leak, found by Brainy.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/dev/usb/umass_isdata.c

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



CVS commit: src/sys/kern

2015-04-04 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Sun Apr  5 02:26:39 UTC 2015

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

Log Message:
make bind() fail with EINVAL if the address family of the provided
socket does not match the address family of the sockaddr received.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/sys/kern/uipc_socket.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/uipc_socket.c
diff -u src/sys/kern/uipc_socket.c:1.236 src/sys/kern/uipc_socket.c:1.237
--- src/sys/kern/uipc_socket.c:1.236	Fri Apr  3 20:01:07 2015
+++ src/sys/kern/uipc_socket.c	Sun Apr  5 02:26:39 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_socket.c,v 1.236 2015/04/03 20:01:07 rtr Exp $	*/
+/*	$NetBSD: uipc_socket.c,v 1.237 2015/04/05 02:26:39 rtr Exp $	*/
 
 /*-
  * Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.236 2015/04/03 20:01:07 rtr Exp $);
+__KERNEL_RCSID(0, $NetBSD: uipc_socket.c,v 1.237 2015/04/05 02:26:39 rtr Exp $);
 
 #include opt_compat_netbsd.h
 #include opt_sock_counters.h
@@ -629,6 +629,10 @@ sobind(struct socket *so, struct sockadd
 	int	error;
 
 	solock(so);
+	if (nam-sa_family != so-so_proto-pr_domain-dom_family) {
+		sounlock(so);
+		return EINVAL;
+	}
 	error = (*so-so_proto-pr_usrreqs-pr_bind)(so, nam, l);
 	sounlock(so);
 	return error;



CVS commit: src/sys/kern

2015-04-04 Thread Tyler R. Retzlaff
Module Name:src
Committed By:   rtr
Date:   Sun Apr  5 02:26:39 UTC 2015

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

Log Message:
make bind() fail with EINVAL if the address family of the provided
socket does not match the address family of the sockaddr received.


To generate a diff of this commit:
cvs rdiff -u -r1.236 -r1.237 src/sys/kern/uipc_socket.c

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



CVS commit: src/libexec/ld.elf_so

2015-04-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Apr  4 18:51:58 UTC 2015

Modified Files:
src/libexec/ld.elf_so: rtld.c

Log Message:
lib/49813: Release mutex on error.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/libexec/ld.elf_so/rtld.c

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



CVS commit: src/libexec/ld.elf_so

2015-04-04 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Sat Apr  4 18:51:58 UTC 2015

Modified Files:
src/libexec/ld.elf_so: rtld.c

Log Message:
lib/49813: Release mutex on error.


To generate a diff of this commit:
cvs rdiff -u -r1.175 -r1.176 src/libexec/ld.elf_so/rtld.c

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

Modified files:

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.175 src/libexec/ld.elf_so/rtld.c:1.176
--- src/libexec/ld.elf_so/rtld.c:1.175	Thu Mar  5 09:49:53 2015
+++ src/libexec/ld.elf_so/rtld.c	Sat Apr  4 18:51:57 2015
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.175 2015/03/05 09:49:53 skrll Exp $	 */
+/*	$NetBSD: rtld.c,v 1.176 2015/04/04 18:51:57 joerg Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rtld.c,v 1.175 2015/03/05 09:49:53 skrll Exp $);
+__RCSID($NetBSD: rtld.c,v 1.176 2015/04/04 18:51:57 joerg Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -1269,7 +1269,7 @@ dladdr(const void *addr, Dl_info *info)
 	obj = _rtld_obj_from_addr(addr);
 	if (obj == NULL) {
 		_rtld_error(No shared object contains address);
-		lookup_mutex_enter();
+		lookup_mutex_exit();
 		return 0;
 	}
 	info-dli_fname = obj-path;



CVS commit: src/external/bsd/tcpdump/dist

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 18:53:51 UTC 2015

Modified Files:
src/external/bsd/tcpdump/dist: print-rpki-rtr.c

Log Message:
Apply commit fb6e5377f392555b8c725f66b8b701f0061a3695:
-Fix/add ND_TCHECK2 tests,
-Fix a buffer overflow,
-Remove a debug printf


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/tcpdump/dist/print-rpki-rtr.c

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



CVS commit: src/external/bsd/tcpdump/dist

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 18:53:51 UTC 2015

Modified Files:
src/external/bsd/tcpdump/dist: print-rpki-rtr.c

Log Message:
Apply commit fb6e5377f392555b8c725f66b8b701f0061a3695:
-Fix/add ND_TCHECK2 tests,
-Fix a buffer overflow,
-Remove a debug printf


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 src/external/bsd/tcpdump/dist/print-rpki-rtr.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/tcpdump/dist/print-rpki-rtr.c
diff -u src/external/bsd/tcpdump/dist/print-rpki-rtr.c:1.1.1.4 src/external/bsd/tcpdump/dist/print-rpki-rtr.c:1.2
--- src/external/bsd/tcpdump/dist/print-rpki-rtr.c:1.1.1.4	Tue Mar 31 17:45:48 2015
+++ src/external/bsd/tcpdump/dist/print-rpki-rtr.c	Sat Apr  4 14:53:51 2015
@@ -178,7 +178,7 @@ rpki_rtr_pdu_print (netdissect_options *
 pdu_header = (rpki_rtr_pdu *)tptr;
 pdu_type = pdu_header-pdu_type;
 pdu_len = EXTRACT_32BITS(pdu_header-length);
-ND_TCHECK2(tptr, pdu_len);
+ND_TCHECK2(*tptr, pdu_len);
 hexdump = FALSE;
 
 ND_PRINT((ndo, %sRPKI-RTRv%u, %s PDU (%u), length: %u,
@@ -255,6 +255,7 @@ rpki_rtr_pdu_print (netdissect_options *
 
 	pdu = (rpki_rtr_pdu_error_report *)tptr;
 	encapsulated_pdu_length = EXTRACT_32BITS(pdu-encapsulated_pdu_length);
+	ND_TCHECK2(*tptr, encapsulated_pdu_length);
 	tlen = pdu_len;
 
 	error_code = EXTRACT_16BITS(pdu-pdu_header.u.error_code);
@@ -287,10 +288,10 @@ rpki_rtr_pdu_print (netdissect_options *
 		tptr += 4;
 		tlen -= 4;
 	}
-printf(text_length: %u tlen %u\n, text_length, tlen);
+	ND_TCHECK2(*tptr, text_length);
 	if (text_length  (text_length = tlen )) {
 		memcpy(buf, tptr, min(sizeof(buf)-1, text_length));
-		buf[text_length] = '\0';
+		buf[min(sizeof(buf) - 1, text_length)] = '\0';
 		ND_PRINT((ndo, %sError text: %s, indent_string(indent+2), buf));
 	}
 	}
@@ -337,13 +338,13 @@ rpki_rtr_print(netdissect_options *ndo, 
 	pdu_header = (rpki_rtr_pdu *)tptr;
 pdu_type = pdu_header-pdu_type;
 pdu_len = EXTRACT_32BITS(pdu_header-length);
+	ND_TCHECK2(*tptr, pdu_len);
 
 /* infinite loop check */
 if (!pdu_type || !pdu_len) {
 break;
 }
 
-ND_TCHECK2(*tptr, pdu_len);
 if (tlen  pdu_len) {
 goto trunc;
 }



Re: CVS commit: src

2015-04-04 Thread Christos Zoulas
On Apr 4,  8:56pm, mar...@duskware.de (Martin Husemann) wrote:
-- Subject: Re: CVS commit: src

| On Sat, Apr 04, 2015 at 11:49:36AM -0400, Christos Zoulas wrote:
|  Are you sure you are not seeing a clock issue?
| 
| No, not sure, but the old objdir is gone now anyway - feel free to remove
| or reword the entry if you think it is not needed.

I don't think it is needed, but I am not going to change it.
Do you have anything in your dmesg about clock changes?

christos


CVS commit: [netbsd-7] src/doc

2015-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  4 19:05:31 UTC 2015

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

Log Message:
Ticket #653


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.247 -r1.1.2.248 src/doc/CHANGES-7.0

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
diff -u src/doc/CHANGES-7.0:1.1.2.247 src/doc/CHANGES-7.0:1.1.2.248
--- src/doc/CHANGES-7.0:1.1.2.247	Sun Mar 29 09:09:50 2015
+++ src/doc/CHANGES-7.0	Sat Apr  4 19:05:31 2015
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-7.0,v 1.1.2.247 2015/03/29 09:09:50 martin Exp $
+# $NetBSD: CHANGES-7.0,v 1.1.2.248 2015/04/04 19:05:31 martin Exp $
 
 A complete list of changes from the initial NetBSD 7.0 branch on 11 Aug 2014
 until the 7.0 release:
@@ -19423,3 +19423,8 @@ sys/kern/exec_elf.c1.71
 	Zero-fill the ELF auxiliary vectors to prevent userland leak.
 	[maxv, ticket #650]
 
+sys/net/if_vlan.c1.80
+
+	Correct frame padding length.
+	[ozaki-r, ticket #653]
+



CVS commit: [netbsd-7] src/doc

2015-04-04 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sat Apr  4 19:05:31 UTC 2015

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

Log Message:
Ticket #653


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.247 -r1.1.2.248 src/doc/CHANGES-7.0

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



Re: CVS commit: src

2015-04-04 Thread Martin Husemann
On Sat, Apr 04, 2015 at 11:49:36AM -0400, Christos Zoulas wrote:
 Are you sure you are not seeing a clock issue?

No, not sure, but the old objdir is gone now anyway - feel free to remove
or reword the entry if you think it is not needed.

Martin


Re: CVS commit: [nick-nhusb] src/sys/dev/usb

2015-04-04 Thread Takahiro HAYASHI

On 2015/04/04 06:33, Nick Hudson wrote:

Module Name:src
Committed By:   skrll
Date:   Fri Apr  3 21:33:23 UTC 2015

Modified Files:
src/sys/dev/usb [nick-nhusb]: uhci.c

Log Message:
Various readability changes.

#ifdef DIAGNOSTIC - KASSERT / __diagused



@@ -3151,10 +3105,8 @@ uhci_device_ctrl_done(struct usbd_xfer *
KASSERT(sc-sc_bus.ub_usepolling || mutex_owned(sc-sc_lock));

UHCIHIST_FUNC(); UHCIHIST_CALLED();
-#ifdef DIAGNOSTIC
-   if (!(xfer-ux_rqflags  URQ_REQUEST))
-   panic(uhci_device_ctrl_done: not a request);
-#endif
+
+   KASSERT(!(xfer-ux_rqflags  URQ_REQUEST));

if (!uhci_active_intr_info(ii))
return;


It seems logic is inverted.


--
t-hash


Re: CVS commit: src

2015-04-04 Thread Christos Zoulas
On Apr 4,  8:56pm, mar...@duskware.de (Martin Husemann) wrote:
-- Subject: Re: CVS commit: src

| On Sat, Apr 04, 2015 at 11:49:36AM -0400, Christos Zoulas wrote:
|  Are you sure you are not seeing a clock issue?
| 
| No, not sure, but the old objdir is gone now anyway - feel free to remove
| or reword the entry if you think it is not needed.

I found out what's wrong (building ops.h at the same time as deps)
and I fixed it.

christos



CVS commit: src/usr.bin/xlint/lint1

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 19:32:06 UTC 2015

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
build ops.h first, because trying to build dependencies and ops.h at the
same time leads to spurious failures.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/Makefile

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

Modified files:

Index: src/usr.bin/xlint/lint1/Makefile
diff -u src/usr.bin/xlint/lint1/Makefile:1.51 src/usr.bin/xlint/lint1/Makefile:1.52
--- src/usr.bin/xlint/lint1/Makefile:1.51	Thu Nov 20 15:48:33 2014
+++ src/usr.bin/xlint/lint1/Makefile	Sat Apr  4 15:32:06 2015
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.51 2014/11/20 20:48:33 christos Exp $
+#	$NetBSD: Makefile,v 1.52 2015/04/04 19:32:06 christos Exp $
 
 .include bsd.own.mk
 
@@ -41,3 +41,5 @@ DPADD+=		${LIBL}
 .include Makefile.ops-c
 
 .include bsd.prog.mk
+
+${SRCS}: ops.h



CVS commit: src/usr.bin/xlint/lint1

2015-04-04 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sat Apr  4 19:32:06 UTC 2015

Modified Files:
src/usr.bin/xlint/lint1: Makefile

Log Message:
build ops.h first, because trying to build dependencies and ops.h at the
same time leads to spurious failures.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/usr.bin/xlint/lint1/Makefile

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