CVS commit: src/sys

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  6 05:37:30 UTC 2019

Modified Files:
src/sys/arch/sun2/sun2: locore.s
src/sys/arch/sun3/sun3: locore.s
src/sys/dev/pci/ixgbe: ixgbe_x550.c

Log Message:
 Fix typo in comment. Found by Wataru Ashihara.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sun2/sun2/locore.s
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sun3/sun3/locore.s
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/ixgbe/ixgbe_x550.c

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



CVS commit: src/sys

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  6 05:37:30 UTC 2019

Modified Files:
src/sys/arch/sun2/sun2: locore.s
src/sys/arch/sun3/sun3: locore.s
src/sys/dev/pci/ixgbe: ixgbe_x550.c

Log Message:
 Fix typo in comment. Found by Wataru Ashihara.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/sun2/sun2/locore.s
cvs rdiff -u -r1.98 -r1.99 src/sys/arch/sun3/sun3/locore.s
cvs rdiff -u -r1.15 -r1.16 src/sys/dev/pci/ixgbe/ixgbe_x550.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/sun2/sun2/locore.s
diff -u src/sys/arch/sun2/sun2/locore.s:1.26 src/sys/arch/sun2/sun2/locore.s:1.27
--- src/sys/arch/sun2/sun2/locore.s:1.26	Wed Dec 19 13:57:50 2018
+++ src/sys/arch/sun2/sun2/locore.s	Tue Aug  6 05:37:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.26 2018/12/19 13:57:50 maxv Exp $	*/
+/*	$NetBSD: locore.s,v 1.27 2019/08/06 05:37:30 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -218,7 +218,7 @@ GLOBAL(addrerr)
  * [this code replaces similarly mmu specific code in the hp300 code]
  */
 sun2_mmu_specific:
-	clrl %d0			| make sure top bits are cleard too
+	clrl %d0			| make sure top bits are cleared too
 	movl %d1,%sp@-			| save %d1
 	movc %sfc,%d1			| save %sfc to %d1
 	moveq #FC_CONTROL,%d0		| %sfc = FC_CONTROL

Index: src/sys/arch/sun3/sun3/locore.s
diff -u src/sys/arch/sun3/sun3/locore.s:1.98 src/sys/arch/sun3/sun3/locore.s:1.99
--- src/sys/arch/sun3/sun3/locore.s:1.98	Wed Dec 19 13:57:51 2018
+++ src/sys/arch/sun3/sun3/locore.s	Tue Aug  6 05:37:30 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.s,v 1.98 2018/12/19 13:57:51 maxv Exp $	*/
+/*	$NetBSD: locore.s,v 1.99 2019/08/06 05:37:30 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1980, 1990, 1993
@@ -248,7 +248,7 @@ Lbe10:
  * [this code replaces similarly mmu specific code in the hp300 code]
  */
 sun3_mmu_specific:
-	clrl %d0			| make sure top bits are cleard too
+	clrl %d0			| make sure top bits are cleared too
 	movl %d1,%sp@-			| save %d1
 	movc %sfc,%d1			| save %sfc to %d1
 	moveq #FC_CONTROL,%d0		| %sfc = FC_CONTROL

Index: src/sys/dev/pci/ixgbe/ixgbe_x550.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15 src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.16
--- src/sys/dev/pci/ixgbe/ixgbe_x550.c:1.15	Thu Jun 27 06:00:11 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_x550.c	Tue Aug  6 05:37:30 2019
@@ -875,7 +875,7 @@ static s32 ixgbe_setup_fw_link(struct ix
 	 *  Broken firmware sets BMCR register incorrectly if
 	 * FW_PHY_ACT_SETUP_LINK_AN isn't set.
 	 * a) FDX may not be set.
-	 * b) BMCR_SPEED1 (bit 6) is always cleard.
+	 * b) BMCR_SPEED1 (bit 6) is always cleared.
 	 * + ---+--+---+-+--+
 	 * |request | BMCR | BMCR spd | BMCR |  |
 	 * || (HEX)| (in bits)|  FDX |  |



CVS commit: src/sys/arch/x86/pci

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  6 05:32:44 UTC 2019

Modified Files:
src/sys/arch/x86/pci: amdsmn.c

Log Message:
 Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/amdsmn.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/x86/pci

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  6 05:32:44 UTC 2019

Modified Files:
src/sys/arch/x86/pci: amdsmn.c

Log Message:
 Whitespace fix.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/x86/pci/amdsmn.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdsmn.c
diff -u src/sys/arch/x86/pci/amdsmn.c:1.5 src/sys/arch/x86/pci/amdsmn.c:1.6
--- src/sys/arch/x86/pci/amdsmn.c:1.5	Thu Jul 18 12:04:16 2019
+++ src/sys/arch/x86/pci/amdsmn.c	Tue Aug  6 05:32:44 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: amdsmn.c,v 1.5 2019/07/18 12:04:16 msaitoh Exp $	*/
+/*	$NetBSD: amdsmn.c,v 1.6 2019/08/06 05:32:44 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2017 Conrad Meyer 
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.5 2019/07/18 12:04:16 msaitoh Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdsmn.c,v 1.6 2019/08/06 05:32:44 msaitoh Exp $ ");
 
 /*
  * Driver for the AMD Family 17h CPU System Management Network.
@@ -78,9 +78,9 @@ static int amdsmn_misc_search(device_t, 
 
 CFATTACH_DECL3_NEW(amdsmn, sizeof(struct amdsmn_softc), amdsmn_match,
 amdsmn_attach, amdsmn_detach, NULL, amdsmn_rescan, NULL, 0);
-
+
 static int
-amdsmn_match(device_t parent, cfdata_t match, void *aux) 
+amdsmn_match(device_t parent, cfdata_t match, void *aux)
 {
 	struct pci_attach_args *pa = aux;
 	unsigned int i;
@@ -95,8 +95,8 @@ amdsmn_match(device_t parent, cfdata_t m
 	return 0;
 }
 
-static int 
-amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux) 
+static int
+amdsmn_misc_search(device_t parent, cfdata_t cf, const int *locs, void *aux)
 {
 	if (config_match(parent, cf, aux))
 		config_attach_loc(parent, cf, locs, aux, NULL);
@@ -104,8 +104,8 @@ amdsmn_misc_search(device_t parent, cfda
 	return 0;
 }
 
-static void 
-amdsmn_attach(device_t parent, device_t self, void *aux) 
+static void
+amdsmn_attach(device_t parent, device_t self, void *aux)
 {
 	struct amdsmn_softc *sc = device_private(self);
 	struct pci_attach_args *pa = aux;
@@ -130,7 +130,7 @@ amdsmn_rescan(device_t self, const char 
 }
 
 static int
-amdsmn_detach(device_t self, int flags) 
+amdsmn_detach(device_t self, int flags)
 {
 	struct amdsmn_softc *sc = device_private(self);
 



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

2019-08-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 02:04:43 UTC 2019

Modified Files:
src/sys/arch/i386/i386: process_machdep.c

Log Message:
Do not dereference user pointer in ptrace_machdep_dorequest()/i386

Always use copyin(9) for reading user memory.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/i386/i386/process_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/i386/i386/process_machdep.c
diff -u src/sys/arch/i386/i386/process_machdep.c:1.93 src/sys/arch/i386/i386/process_machdep.c:1.94
--- src/sys/arch/i386/i386/process_machdep.c:1.93	Wed Jun 26 12:30:12 2019
+++ src/sys/arch/i386/i386/process_machdep.c	Tue Aug  6 02:04:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.93 2019/06/26 12:30:12 mgorny Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.94 2019/08/06 02:04:43 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -75,7 +75,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.93 2019/06/26 12:30:12 mgorny Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.94 2019/08/06 02:04:43 kamil Exp $");
 
 #include "opt_ptrace.h"
 
@@ -281,7 +281,7 @@ ptrace_machdep_dorequest(
 {
 	struct uio uio;
 	struct iovec iov;
-	struct iovec *user_iov = (struct iovec*)addr;
+	struct iovec user_iov;
 	struct vmspace *vm;
 	int error;
 	int write = 0;
@@ -319,12 +319,14 @@ ptrace_machdep_dorequest(
 		/* write = 0 done above. */
 		if (!process_machdep_validxstate(lt->l_proc))
 			return EINVAL;
+		if ((error = copyin(addr, &user_iov, sizeof(user_iov))) != 0)
+			return error;
 		error = proc_vmspace_getref(l->l_proc, &vm);
 		if (error) {
 			return error;
 		}
-		iov.iov_base = user_iov->iov_base;
-		iov.iov_len = user_iov->iov_len;
+		iov.iov_base = user_iov.iov_base;
+		iov.iov_len = user_iov.iov_len;
 		if (iov.iov_len > sizeof(struct xstate))
 			iov.iov_len = sizeof(struct xstate);
 		uio.uio_iov = &iov;



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

2019-08-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 02:04:43 UTC 2019

Modified Files:
src/sys/arch/i386/i386: process_machdep.c

Log Message:
Do not dereference user pointer in ptrace_machdep_dorequest()/i386

Always use copyin(9) for reading user memory.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/i386/i386/process_machdep.c

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



Re: CVS commit: src/sys/dev/acpi

2019-08-05 Thread Masanobu SAITOH
On 2019/08/05 23:06, Joerg Sonnenberger wrote:
> On Mon, Aug 05, 2019 at 10:12:04AM +, SAITOH Masanobu wrote:
>> Module Name: src
>> Committed By:msaitoh
>> Date:Mon Aug  5 10:12:04 UTC 2019
>>
>> Modified Files:
>>  src/sys/dev/acpi: acpi_ec.c
>>
>> Log Message:
>> - Fix a bug that acpiec_space_handler() doesn't access more than 64bit
>>   correctly. Found by kUBSan on Thinkpad X220. acpiec0 accessed 128bits from
>>   address 0xa0. The error message was:
>>
>>  UBSan: Undefined Behavior in ../../../../dev/acpi/acpi_ec.c:672:32, 
>> shift exponent 64 is too large for 64-bit type 'long unsigned int'
> 
> Ignore all the gracious changes that make the diff harder to read than
> necessary, doesn't this break the case of width == 0?

Oh, you're correct. When I noticed our code didn't increment the address,
I read FreeBSD's acpi_ec.c and did the same way. It seems old NetBSD,
OpenBSD and linux do the same way but FreeBSD doesn't.

 I committed the change to keep the old behavior.

Thanks.

> Joerg
> 


-- 
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


CVS commit: src/sys/dev/acpi

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  6 01:53:47 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_ec.c

Log Message:
- Make the case that width < 8 behave as the same as before. Pointed out by
  Joerg.
- Change "switch" to "if" for simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/acpi/acpi_ec.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/acpi

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Aug  6 01:53:47 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_ec.c

Log Message:
- Make the case that width < 8 behave as the same as before. Pointed out by
  Joerg.
- Change "switch" to "if" for simplify.


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/dev/acpi/acpi_ec.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/acpi/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.76 src/sys/dev/acpi/acpi_ec.c:1.77
--- src/sys/dev/acpi/acpi_ec.c:1.76	Mon Aug  5 10:12:04 2019
+++ src/sys/dev/acpi/acpi_ec.c	Tue Aug  6 01:53:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.76 2019/08/05 10:12:04 msaitoh Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.77 2019/08/06 01:53:47 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.76 2019/08/05 10:12:04 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.77 2019/08/06 01:53:47 msaitoh Exp $");
 
 #include 
 #include 
@@ -679,20 +679,15 @@ acpiec_space_handler(uint32_t func, ACPI
 	if (func == ACPI_READ)
 		*value = 0;
 
-	do {
-		switch (func) {
-		case ACPI_READ:
+	for (addr = paddr; addr < (paddr + width / 8); addr++, reg++) {
+		if (func == ACPI_READ)
 			rv = acpiec_read(dv, addr, reg);
-			break;
-		case ACPI_WRITE:
+		else
 			rv = acpiec_write(dv, addr, *reg);
-			break;
-		}
+
 		if (rv != AE_OK)
 			break;
-		addr++;
-		reg++;
-	} while (addr < (paddr + width / 8));
+	}
 
 	return rv;
 }



CVS commit: src/sys/dev/usb

2019-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 01:44:24 UTC 2019

Modified Files:
src/sys/dev/usb: files.usb

Log Message:
mark axe(4) and ure(4) as needing usbnet


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/usb/files.usb

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

2019-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 01:44:24 UTC 2019

Modified Files:
src/sys/dev/usb: files.usb

Log Message:
mark axe(4) and ure(4) as needing usbnet


To generate a diff of this commit:
cvs rdiff -u -r1.158 -r1.159 src/sys/dev/usb/files.usb

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/files.usb
diff -u src/sys/dev/usb/files.usb:1.158 src/sys/dev/usb/files.usb:1.159
--- src/sys/dev/usb/files.usb:1.158	Wed Jul 31 10:19:55 2019
+++ src/sys/dev/usb/files.usb	Tue Aug  6 01:44:24 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.usb,v 1.158 2019/07/31 10:19:55 martin Exp $
+#	$NetBSD: files.usb,v 1.159 2019/08/06 01:44:24 mrg Exp $
 #
 # Config file and device description for machine-independent USB code.
 # Included by ports that need it.  Ports that use it must provide
@@ -363,7 +363,7 @@ attach	url at usbdevif
 file	dev/usb/if_url.c		url
 
 # ASIX AX88172
-device	axe: arp, ether, ifnet, mii, mii_phy
+device	axe: arp, ether, ifnet, mii, mii_phy, usbnet
 attach	axe at usbdevif
 file	dev/usb/if_axe.c		axe
 
@@ -393,7 +393,7 @@ attach	umb at usbifif
 file	dev/usb/if_umb.c		umb
 
 # RealTek RTL8152 and RTL8153
-device	ure: arp, ether, ifnet, mii, mii_phy
+device	ure: arp, ether, ifnet, mii, mii_phy, usbnet
 attach	ure at usbdevif
 file	dev/usb/if_ure.c		ure
 



CVS commit: src/sys/dev/usb

2019-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 01:42:22 UTC 2019

Modified Files:
src/sys/dev/usb: if_axe.c if_axen.c if_cdce.c if_ure.c usbnet.c

Log Message:
for ethernet usb network devices, print the mac addr in usbnet.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/usbnet.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_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.105 src/sys/dev/usb/if_axe.c:1.106
--- src/sys/dev/usb/if_axe.c:1.105	Tue Aug  6 00:19:57 2019
+++ src/sys/dev/usb/if_axe.c	Tue Aug  6 01:42:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.105 2019/08/06 00:19:57 mrg Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.106 2019/08/06 01:42:22 mrg Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.105 2019/08/06 00:19:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.106 2019/08/06 01:42:22 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -977,12 +977,6 @@ axe_attach(device_t parent, device_t sel
 
 	usbnet_unlock_mii(un);
 
-	/*
-	 * An ASIX chip was detected. Inform the world.
-	 */
-	aprint_normal_dev(self, "Ethernet address %s\n",
-	ether_sprintf(un->un_eaddr));
-
 	if (AXE_IS_178_FAMILY(sc))
 		usbnet_ec(un)->ec_capabilities = ETHERCAP_VLAN_MTU;
 	if (sc->axe_flags & AX772B) {

Index: src/sys/dev/usb/if_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.55 src/sys/dev/usb/if_axen.c:1.56
--- src/sys/dev/usb/if_axen.c:1.55	Tue Aug  6 00:19:57 2019
+++ src/sys/dev/usb/if_axen.c	Tue Aug  6 01:42:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axen.c,v 1.55 2019/08/06 00:19:57 mrg Exp $	*/
+/*	$NetBSD: if_axen.c,v 1.56 2019/08/06 01:42:22 mrg Exp $	*/
 /*	$OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.55 2019/08/06 00:19:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.56 2019/08/06 01:42:22 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -708,8 +708,6 @@ axen_attach(device_t parent, device_t se
 		aprint_normal_dev(self, "AX88179\n");
 	else
 		aprint_normal_dev(self, "(unknown)\n");
-	aprint_normal_dev(self, "Ethernet address %s\n",
-	ether_sprintf(un->un_eaddr));
 
 	struct ethercom *ec = usbnet_ec(un);
 	ec->ec_capabilities = ETHERCAP_VLAN_MTU;

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.57 src/sys/dev/usb/if_cdce.c:1.58
--- src/sys/dev/usb/if_cdce.c:1.57	Tue Aug  6 00:19:57 2019
+++ src/sys/dev/usb/if_cdce.c	Tue Aug  6 01:42:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.57 2019/08/06 00:19:57 mrg Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.58 2019/08/06 01:42:22 mrg Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.57 2019/08/06 00:19:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.58 2019/08/06 01:42:22 mrg Exp $");
 
 #include 
 #include 
@@ -250,8 +250,6 @@ cdce_attach(device_t parent, device_t se
 		un->un_eaddr[5] = (uint8_t)(device_unit(un->un_dev));
 	}
 
-	aprint_normal_dev(self, "address %s\n", ether_sprintf(un->un_eaddr));
-
 	usbnet_attach(un, "cdcedet", CDCE_RX_LIST_CNT, CDCE_TX_LIST_CNT);
 	usbnet_attach_ifp(un, false, IFF_SIMPLEX | IFF_BROADCAST | IFF_MULTICAST,
 0, 0);

Index: src/sys/dev/usb/if_ure.c
diff -u src/sys/dev/usb/if_ure.c:1.17 src/sys/dev/usb/if_ure.c:1.18
--- src/sys/dev/usb/if_ure.c:1.17	Tue Aug  6 00:19:57 2019
+++ src/sys/dev/usb/if_ure.c	Tue Aug  6 01:42:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ure.c,v 1.17 2019/08/06 00:19:57 mrg Exp $	*/
+/*	$NetBSD: if_ure.c,v 1.18 2019/08/06 01:42:22 mrg Exp $	*/
 /*	$OpenBSD: if_ure.c,v 1.10 2018/11/02 21:32:30 jcs Exp $	*/
 
 /*-
@@ -30,7 +30,7 @@
 /* RealTek RTL8152/RTL8153 10/100/Gigabit USB Ethernet device */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.17 2019/08/06 00:19:57 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ure.c,v 1.18 2019/08/06 01:42:22 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -939,9 +939,6 @@ ure_attach(device_t parent, device_t sel
 	usbnet_unlock(un);
 	memcpy(un->un_eaddr, eaddr, sizeof un->un_eaddr);
 
-	aprint_normal_dev(self, "Ethernet address %s\n",
-	   ether_sprintf(un->un_eaddr));
-
 	struct ifnet *ifp = usbnet_ifp(un);
 
 	/*

Index: src/sys/dev/usb/usbnet.c
diff -u src/sys/dev/usb/usbnet.c:1.5 src/sys/dev/usb/usbnet.c:1.6
--- src/sys/dev/usb/usbnet.c:1.5	Tue Aug  6 00:19:57 2019
+++ src/sys/dev/usb/usbnet.c	Tue Aug  6 01:42:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbnet.c,v 1.5 2019/08/06 00:19:57 mrg Exp $	*/
+/*	$NetBSD: usbnet.c,

CVS commit: src/sys/dev/usb

2019-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 01:42:22 UTC 2019

Modified Files:
src/sys/dev/usb: if_axe.c if_axen.c if_cdce.c if_ure.c usbnet.c

Log Message:
for ethernet usb network devices, print the mac addr in usbnet.


To generate a diff of this commit:
cvs rdiff -u -r1.105 -r1.106 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.57 -r1.58 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/usbnet.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/amd64/amd64

2019-08-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 01:34:29 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: process_machdep.c

Log Message:
Do not dereference user pointer in ptrace_machdep_dorequest()/amd64

Always use copyin(9) for reading user memory.

This fixes SMAP crash on some amd64 machines.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amd64/amd64/process_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/amd64/process_machdep.c
diff -u src/sys/arch/amd64/amd64/process_machdep.c:1.43 src/sys/arch/amd64/amd64/process_machdep.c:1.44
--- src/sys/arch/amd64/amd64/process_machdep.c:1.43	Wed Jul 24 16:36:47 2019
+++ src/sys/arch/amd64/amd64/process_machdep.c	Tue Aug  6 01:34:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: process_machdep.c,v 1.43 2019/07/24 16:36:47 bouyer Exp $	*/
+/*	$NetBSD: process_machdep.c,v 1.44 2019/08/06 01:34:29 kamil Exp $	*/
 
 /*
  * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
@@ -74,7 +74,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.43 2019/07/24 16:36:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: process_machdep.c,v 1.44 2019/08/06 01:34:29 kamil Exp $");
 
 #include "opt_xen.h"
 #include 
@@ -327,14 +327,21 @@ ptrace_machdep_dorequest(
 		if (!process_machdep_validxstate(lt->l_proc))
 			return EINVAL;
 		if (__predict_false(l->l_proc->p_flag & PK_32)) {
-			struct netbsd32_iovec *user_iov = addr;
-			iov.iov_base = NETBSD32PTR64(user_iov->iov_base);
-			iov.iov_len = user_iov->iov_len;
+			struct netbsd32_iovec user_iov;
+			if ((error = copyin(addr, &user_iov, sizeof(user_iov)))
+			!= 0)
+return error;
+
+			iov.iov_base = NETBSD32PTR64(user_iov.iov_base);
+			iov.iov_len = user_iov.iov_len;
 		} else {
-			struct iovec *user_iov;
-			user_iov = (struct iovec*)addr;
-			iov.iov_base = user_iov->iov_base;
-			iov.iov_len = user_iov->iov_len;
+			struct iovec user_iov;
+			if ((error = copyin(addr, &user_iov, sizeof(user_iov)))
+			!= 0)
+return error;
+
+			iov.iov_base = user_iov.iov_base;
+			iov.iov_len = user_iov.iov_len;
 		}
 
 		error = proc_vmspace_getref(l->l_proc, &vm);



CVS commit: src/sys/arch/amd64/amd64

2019-08-05 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Tue Aug  6 01:34:29 UTC 2019

Modified Files:
src/sys/arch/amd64/amd64: process_machdep.c

Log Message:
Do not dereference user pointer in ptrace_machdep_dorequest()/amd64

Always use copyin(9) for reading user memory.

This fixes SMAP crash on some amd64 machines.

Reported by 


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/amd64/amd64/process_machdep.c

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



CVS commit: src/sys

2019-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 00:19:57 UTC 2019

Modified Files:
src/sys/dev/usb: if_axe.c if_axen.c if_cdce.c if_ure.c usbnet.c
usbnet.h
src/sys/sys: param.h

Log Message:
extend usbnet to cope with if_upl, if_smsc, and if_umb needs:

- usbnet_enqueue() can set mbuf flags and csum_data
- usbnet_input() for non-ethernet based devices (upl, umb)
- allow a complete override for ioctl()
- remove converted list -- we have compiling and/or working patches for
  all the devices except for umb(4), will be merged as testing happens

hopefully this is the last ABI change, though  it may end up being
extended for additional smsc(4)  support.

hello for real netbsd 9.99.3!


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/usbnet.c src/sys/dev/usb/usbnet.h
cvs rdiff -u -r1.601 -r1.602 src/sys/sys/param.h

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



CVS commit: src/sys

2019-08-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Aug  6 00:19:57 UTC 2019

Modified Files:
src/sys/dev/usb: if_axe.c if_axen.c if_cdce.c if_ure.c usbnet.c
usbnet.h
src/sys/sys: param.h

Log Message:
extend usbnet to cope with if_upl, if_smsc, and if_umb needs:

- usbnet_enqueue() can set mbuf flags and csum_data
- usbnet_input() for non-ethernet based devices (upl, umb)
- allow a complete override for ioctl()
- remove converted list -- we have compiling and/or working patches for
  all the devices except for umb(4), will be merged as testing happens

hopefully this is the last ABI change, though  it may end up being
extended for additional smsc(4)  support.

hello for real netbsd 9.99.3!


To generate a diff of this commit:
cvs rdiff -u -r1.104 -r1.105 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.54 -r1.55 src/sys/dev/usb/if_axen.c
cvs rdiff -u -r1.56 -r1.57 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/if_ure.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/usbnet.c src/sys/dev/usb/usbnet.h
cvs rdiff -u -r1.601 -r1.602 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/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.104 src/sys/dev/usb/if_axe.c:1.105
--- src/sys/dev/usb/if_axe.c:1.104	Sun Aug  4 09:03:46 2019
+++ src/sys/dev/usb/if_axe.c	Tue Aug  6 00:19:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.104 2019/08/04 09:03:46 mrg Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.105 2019/08/06 00:19:57 mrg Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.104 2019/08/04 09:03:46 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.105 2019/08/06 00:19:57 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1150,7 +1150,7 @@ axe_rx_loop_cb(struct usbnet * un, struc
 			total_len = 0;
 		}
 
-		usbnet_enqueue(un, buf, pktlen, flags);
+		usbnet_enqueue(un, buf, pktlen, flags, 0, 0);
 		buf += rxlen;
 
 	} while (total_len > 0);

Index: src/sys/dev/usb/if_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.54 src/sys/dev/usb/if_axen.c:1.55
--- src/sys/dev/usb/if_axen.c:1.54	Mon Aug  5 07:03:55 2019
+++ src/sys/dev/usb/if_axen.c	Tue Aug  6 00:19:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axen.c,v 1.54 2019/08/05 07:03:55 skrll Exp $	*/
+/*	$NetBSD: if_axen.c,v 1.55 2019/08/06 00:19:57 mrg Exp $	*/
 /*	$OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.54 2019/08/05 07:03:55 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.55 2019/08/06 00:19:57 mrg Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -153,7 +153,7 @@ axen_mii_write_reg(struct usbnet *un, in
 }
 
 static void
-axen_miibus_statchg(struct ifnet *ifp)
+axen_mii_statchg(struct ifnet *ifp)
 {
 	struct usbnet * const un = ifp->if_softc;
 	struct axen_softc * const sc = usbnet_softc(un);
@@ -623,7 +623,7 @@ axen_attach(device_t parent, device_t se
 	un->un_ioctl_cb = axen_ioctl_cb;
 	un->un_read_reg_cb = axen_mii_read_reg;
 	un->un_write_reg_cb = axen_mii_write_reg;
-	un->un_statchg_cb = axen_miibus_statchg;
+	un->un_statchg_cb = axen_mii_statchg;
 	un->un_tx_prepare_cb = axen_tx_prepare;
 	un->un_rx_loop_cb = axen_rxeof_loop;
 	un->un_init_cb = axen_init;
@@ -857,7 +857,7 @@ axen_rxeof_loop(struct usbnet *un, struc
 		}
 
 		usbnet_enqueue(un, buf + 2, pkt_len - 6,
-			   axen_csum_flags_rx(ifp, pkt_hdr));
+			   axen_csum_flags_rx(ifp, pkt_hdr), 0, 0);
 
 nextpkt:
 		/*

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.56 src/sys/dev/usb/if_cdce.c:1.57
--- src/sys/dev/usb/if_cdce.c:1.56	Sun Aug  4 08:59:13 2019
+++ src/sys/dev/usb/if_cdce.c	Tue Aug  6 00:19:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.56 2019/08/04 08:59:13 mrg Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.57 2019/08/06 00:19:57 mrg Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul 
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.56 2019/08/04 08:59:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.57 2019/08/06 00:19:57 mrg Exp $");
 
 #include 
 #include 
@@ -81,8 +81,8 @@ static const struct cdce_type cdce_devs[
 static int	cdce_match(device_t, cfdata_t, void *);
 static void	cdce_attach(device_t, device_t, void *);
 static int	cdce_init(struct ifnet *);
-static void	cdce_rxeof_loop(struct usbnet *, struct usbd_xfer *,
-struct usbnet_chain *, uint32_t);
+static void	cdce_rx_loop(struct usbnet *, struct usbd_xfer *,
+			 struct usbnet_chain *, uint32_t);
 static unsigned	cdce_tx_prepare(struct usbnet *, struct mbuf *,
 struct usbnet_chain *);
 
@@ -136,7 +136,7 @@ cdce_attach(device_t parent, device_t se
 	un->un_sc = sc;
 	un->un_init_cb = cdce_init;
 	un->un_tx_prepare_cb = cdce_tx_prepare;
-	un->un_rx_loop_cb = cdce_rxeof_

CVS commit: src/sys/dev/spi

2019-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  5 23:42:48 UTC 2019

Modified Files:
src/sys/dev/spi: files.spi

Log Message:
spi: make the "slave" config(5) locator optional

needed to be able to support FDT direct attachment of SPI slaves


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spi/files.spi

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/spi/files.spi
diff -u src/sys/dev/spi/files.spi:1.5 src/sys/dev/spi/files.spi:1.6
--- src/sys/dev/spi/files.spi:1.5	Tue Aug 18 15:54:20 2015
+++ src/sys/dev/spi/files.spi	Mon Aug  5 23:42:48 2019
@@ -1,8 +1,8 @@
-#	$NetBSD: files.spi,v 1.5 2015/08/18 15:54:20 phx Exp $
+#	$NetBSD: files.spi,v 1.6 2019/08/05 23:42:48 tnn Exp $
 
 define	spibus { }
 
-device	spi { slave }
+device	spi { [slave = -1] }
 attach	spi at spibus
 file	dev/spi/spi.c			spi | spibus
 



CVS commit: src/sys/dev/spi

2019-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  5 23:42:48 UTC 2019

Modified Files:
src/sys/dev/spi: files.spi

Log Message:
spi: make the "slave" config(5) locator optional

needed to be able to support FDT direct attachment of SPI slaves


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/spi/files.spi

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



CVS commit: src/share/man/man7

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 22:03:10 UTC 2019

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Provide documentation for KERN_LWP.

PR lib/20108


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/share/man/man7/sysctl.7

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



CVS commit: src/share/man/man7

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 22:03:10 UTC 2019

Modified Files:
src/share/man/man7: sysctl.7

Log Message:
Provide documentation for KERN_LWP.

PR lib/20108


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/share/man/man7/sysctl.7

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/man7/sysctl.7
diff -u src/share/man/man7/sysctl.7:1.139 src/share/man/man7/sysctl.7:1.140
--- src/share/man/man7/sysctl.7:1.139	Sat Jun  1 19:54:34 2019
+++ src/share/man/man7/sysctl.7	Mon Aug  5 22:03:10 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysctl.7,v 1.139 2019/06/01 19:54:34 kamil Exp $
+.\"	$NetBSD: sysctl.7,v 1.140 2019/08/05 22:03:10 maya Exp $
 .\"
 .\" Copyright (c) 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\"	@(#)sysctl.3	8.4 (Berkeley) 5/9/95
 .\"
-.Dd June 1, 2019
+.Dd August 6, 2019
 .Dt SYSCTL 7
 .Os
 .Sh NAME
@@ -308,6 +308,7 @@ privilege may change the value.
 .It kern.labelsector	integer	no
 .It kern.login_name_max	integer	no
 .It kern.logsigexit	integer	yes
+.It kern.lwp	struct kinfo_lwp	yes
 .It kern.mapped_files	integer	no
 .It kern.maxfiles	integer	yes
 .It kern.maxlwp	integer	yes
@@ -727,6 +728,12 @@ If this flag is non-zero, the kernel wil
 all process exits due to signals which create a
 .Xr core 5
 file, and whether the coredump was created.
+.It Li kern.lwp ( Dv KERN_LWP )
+Returns information about the current light-weight process.
+The
+.Sy kinfo_lwp
+structure is defined in
+.In sys/sysctl.h .
 .It Li kern.mapped_files ( Dv KERN_MAPPED_FILES )
 Returns 1 if the
 .St -p1003.1b-93
@@ -1347,7 +1354,6 @@ Each element of the array contains the k
 .Vt struct vnode *
 followed by the vnode itself
 .Vt struct vnode .
-.\" XXX: Undocumented: kern.lwp: no children?
 .El
 .Ss The machdep.* subtree
 The set of variables defined is architecture dependent.



CVS commit: src/sys/uvm

2019-08-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Aug  5 17:36:42 UTC 2019

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
fix two bugs reported in
https://syzkaller.appspot.com/bug?id=8840dce484094a926e1ec388ffb83acb2fa291c9

 - in uvm_fault_check(), if the map entry is wired, handle the fault the same 
way
   that we would handle UVM_FAULT_WIRE.  faulting on wired mappings is valid
   if the mapped object was truncated and then later grown again.

 - in uvm_fault_unwire_locked(), we must hold the locks for the vm_map_entry
   while calling pmap_extract() in order to avoid races with the mapped object
   being truncated while we are unwiring it.

Reported-by: syzbot+2e0ae2fc35ab7301c...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/uvm/uvm_fault.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/uvm/uvm_fault.c
diff -u src/sys/uvm/uvm_fault.c:1.206 src/sys/uvm/uvm_fault.c:1.207
--- src/sys/uvm/uvm_fault.c:1.206	Tue May 28 08:59:35 2019
+++ src/sys/uvm/uvm_fault.c	Mon Aug  5 17:36:42 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_fault.c,v 1.206 2019/05/28 08:59:35 msaitoh Exp $	*/
+/*	$NetBSD: uvm_fault.c,v 1.207 2019/08/05 17:36:42 chs Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.206 2019/05/28 08:59:35 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_fault.c,v 1.207 2019/08/05 17:36:42 chs Exp $");
 
 #include "opt_uvmhist.h"
 
@@ -996,8 +996,11 @@ uvm_fault_check(
 	 */
 
 	flt->enter_prot = ufi->entry->protection;
-	if (VM_MAPENT_ISWIRED(ufi->entry))
+	if (VM_MAPENT_ISWIRED(ufi->entry)) {
 		flt->wire_mapping = true;
+		flt->wire_paging = true;
+		flt->narrow = true;
+	}
 
 	if (flt->wire_mapping) {
 		flt->access_type = flt->enter_prot; /* full access for wired */
@@ -2437,8 +2440,6 @@ uvm_fault_unwire_locked(struct vm_map *m
 
 	oentry = NULL;
 	for (va = start; va < end; va += PAGE_SIZE) {
-		if (pmap_extract(pmap, va, &pa) == false)
-			continue;
 
 		/*
 		 * find the map entry for the current address.
@@ -2469,6 +2470,9 @@ uvm_fault_unwire_locked(struct vm_map *m
 		 * if the entry is no longer wired, tell the pmap.
 		 */
 
+		if (!pmap_extract(pmap, va, &pa))
+			continue;
+
 		if (VM_MAPENT_ISWIRED(entry) == 0)
 			pmap_unwire(pmap, va);
 



CVS commit: src/sys/uvm

2019-08-05 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Aug  5 17:36:42 UTC 2019

Modified Files:
src/sys/uvm: uvm_fault.c

Log Message:
fix two bugs reported in
https://syzkaller.appspot.com/bug?id=8840dce484094a926e1ec388ffb83acb2fa291c9

 - in uvm_fault_check(), if the map entry is wired, handle the fault the same 
way
   that we would handle UVM_FAULT_WIRE.  faulting on wired mappings is valid
   if the mapped object was truncated and then later grown again.

 - in uvm_fault_unwire_locked(), we must hold the locks for the vm_map_entry
   while calling pmap_extract() in order to avoid races with the mapped object
   being truncated while we are unwiring it.

Reported-by: syzbot+2e0ae2fc35ab7301c...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.206 -r1.207 src/sys/uvm/uvm_fault.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/aarch64/include

2019-08-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Aug  5 16:24:48 UTC 2019

Modified Files:
src/sys/arch/aarch64/include: asm.h

Log Message:
Don't define register replacements when targetting 32bit ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/asm.h

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



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

2019-08-05 Thread Joerg Sonnenberger
Module Name:src
Committed By:   joerg
Date:   Mon Aug  5 16:24:48 UTC 2019

Modified Files:
src/sys/arch/aarch64/include: asm.h

Log Message:
Don't define register replacements when targetting 32bit ARM.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/aarch64/include/asm.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/aarch64/include/asm.h
diff -u src/sys/arch/aarch64/include/asm.h:1.3 src/sys/arch/aarch64/include/asm.h:1.4
--- src/sys/arch/aarch64/include/asm.h:1.3	Tue Jul 17 18:08:37 2018
+++ src/sys/arch/aarch64/include/asm.h	Mon Aug  5 16:24:48 2019
@@ -1,11 +1,13 @@
-/* $NetBSD: asm.h,v 1.3 2018/07/17 18:08:37 christos Exp $ */
+/* $NetBSD: asm.h,v 1.4 2019/08/05 16:24:48 joerg Exp $ */
 
 #ifndef _AARCH64_ASM_H_
 #define _AARCH64_ASM_H_
 
 #include 
 
+#ifdef __aarch64__
 #define	fp	x29
 #define	lr	x30
+#endif
 
 #endif /* !_AARCH64_ASM_H_ */



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

2019-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  5 15:30:37 UTC 2019

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

Log Message:
rkspi* at fdt?


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/evbarm/conf/GENERIC64

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

Modified files:

Index: src/sys/arch/evbarm/conf/GENERIC64
diff -u src/sys/arch/evbarm/conf/GENERIC64:1.103 src/sys/arch/evbarm/conf/GENERIC64:1.104
--- src/sys/arch/evbarm/conf/GENERIC64:1.103	Thu Jul 25 00:30:45 2019
+++ src/sys/arch/evbarm/conf/GENERIC64	Mon Aug  5 15:30:37 2019
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: GENERIC64,v 1.103 2019/07/25 00:30:45 jmcneill Exp $
+#	$NetBSD: GENERIC64,v 1.104 2019/08/05 15:30:37 tnn Exp $
 #
 #	GENERIC ARM (aarch64) kernel
 #
@@ -399,6 +399,7 @@ ld*		at nvme? nsid ?
 
 # SPI controllers
 bcmspi*		at fdt?			# Broadcom BCM283x SPI
+rkspi*		at fdt?			# Rockchip SPI
 spi*		at spibus?
 
 # Audio support



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

2019-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  5 15:30:37 UTC 2019

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

Log Message:
rkspi* at fdt?


To generate a diff of this commit:
cvs rdiff -u -r1.103 -r1.104 src/sys/arch/evbarm/conf/GENERIC64

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



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

2019-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  5 15:22:59 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: files.rockchip
Added Files:
src/sys/arch/arm/rockchip: rk_spi.c

Log Message:
rk_spi: Rockchip SPI driver

Match only on RK3399 for now, but should work on RK3328 as well with
the proper CRU support. If you can, please test and enable for RK3328.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/rockchip/rk_spi.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/rockchip/files.rockchip
diff -u src/sys/arch/arm/rockchip/files.rockchip:1.19 src/sys/arch/arm/rockchip/files.rockchip:1.20
--- src/sys/arch/arm/rockchip/files.rockchip:1.19	Wed May  1 10:41:33 2019
+++ src/sys/arch/arm/rockchip/files.rockchip	Mon Aug  5 15:22:59 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: files.rockchip,v 1.19 2019/05/01 10:41:33 jmcneill Exp $
+#	$NetBSD: files.rockchip,v 1.20 2019/08/05 15:22:59 tnn Exp $
 #
 # Configuration info for Rockchip family SoCs
 #
@@ -42,6 +42,11 @@ device	rkiic: i2cbus, i2cexec
 attach	rkiic at fdt with rk_i2c
 file	arch/arm/rockchip/rk_i2c.c		rk_i2c
 
+# SPI
+device	rkspi: spibus
+attach	rkspi at fdt with rk_spi
+file	arch/arm/rockchip/rk_spi.c		rk_spi
+
 # USB PHY
 device	rkusb { }
 attach	rkusb at fdt with rk_usb

Added files:

Index: src/sys/arch/arm/rockchip/rk_spi.c
diff -u /dev/null src/sys/arch/arm/rockchip/rk_spi.c:1.1
--- /dev/null	Mon Aug  5 15:22:59 2019
+++ src/sys/arch/arm/rockchip/rk_spi.c	Mon Aug  5 15:22:59 2019
@@ -0,0 +1,517 @@
+/*	$NetBSD: rk_spi.c,v 1.1 2019/08/05 15:22:59 tnn Exp $	*/
+
+/*
+ * Copyright (c) 2019 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tobias Nygren.
+ *
+ * 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 
+__KERNEL_RCSID(0, "$NetBSD: rk_spi.c,v 1.1 2019/08/05 15:22:59 tnn Exp $");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#define SPI_CTRLR0		0x00
+#define SPI_CTRLR0_MTM		__BIT(21)
+#define SPI_CTRLR0_OPM		__BIT(20)
+#define SPI_CTRLR0_XFM		__BITS(19, 18)
+#define SPI_CTRLR0_FRF		__BITS(17, 16)
+#define SPI_CTRLR0_RSD		__BITS(15, 14)
+#define SPI_CTRLR0_BHT		__BIT(13)
+#define SPI_CTRLR0_FBM		__BIT(12)
+#define SPI_CTRLR0_EM		__BIT(11)
+#define SPI_CTRLR0_RW		__BIT(10)
+#define SPI_CTRLR0_CSM		__BITS(9, 8)
+#define SPI_CTRLR0_SCPOL	__BIT(7)
+#define SPI_CTRLR0_SCPH		__BIT(6)
+#define SPI_CTRLR0_CFS		__BITS(5, 2)
+#define SPI_CTRLR0_DFS		__BITS(1, 0)
+#define SPI_CTRLR0_DFS_4BIT	0x0
+#define SPI_CTRLR0_DFS_8BIT	0x1
+#define SPI_CTRLR0_DFS_16BIT	0x2
+
+#define SPI_CTRLR1		0x04
+#define SPI_CTRLR1_NDM		__BITS(15, 0)
+
+#define SPI_ENR			0x08
+#define SPI_ENR_ENR		__BIT(0)
+
+#define SPI_SER			0x0c
+#define SPI_SER_SER1		__BIT(1)
+#define SPI_SER_SER0		__BIT(0)
+
+#define SPI_BAUDR		0x10
+#define SPI_BAUDR_BAUDR		__BITS(15, 0)
+
+#define SPI_TXFTLR		0x14
+#define SPI_TXFTLR_TXFLTR	__BITS(4, 0)
+
+#define SPI_RXFTLR		0x18
+#define SPI_RXFLTR_RXFLTR	__BITS(4, 0)
+
+#define SPI_TXFLR		0x1c
+#define SPI_TXFLR_TXFLR		__BITS(5, 0)
+
+#define SPI_RXFLR		0x20
+#define SPI_RXFLR_RXFLR		__BITS(5, 0)
+
+#define SPI_SR			0x24
+#define SPI_SR_RFF		__BIT(4)
+#define SPI_SR_RFE		__BIT(3)
+#define SPI_SR_TFE		__BIT(2)
+#define SPI_SR_TFF		__BIT(1)
+#define SPI_SR_BSF		__BIT(0)
+
+#define SPI_IPR			0x28
+#define SPI_IPR_IPR		__BIT(0)
+
+#define SPI_IMR			0x2c
+#define SPI_IMR_RFFIM		__BIT(4)
+#define SPI_IMR_RFOIM		__BIT(3

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

2019-08-05 Thread Tobias Nygren
Module Name:src
Committed By:   tnn
Date:   Mon Aug  5 15:22:59 UTC 2019

Modified Files:
src/sys/arch/arm/rockchip: files.rockchip
Added Files:
src/sys/arch/arm/rockchip: rk_spi.c

Log Message:
rk_spi: Rockchip SPI driver

Match only on RK3399 for now, but should work on RK3328 as well with
the proper CRU support. If you can, please test and enable for RK3328.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/arm/rockchip/files.rockchip
cvs rdiff -u -r0 -r1.1 src/sys/arch/arm/rockchip/rk_spi.c

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



CVS commit: src/share/man/man4

2019-08-05 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Mon Aug  5 15:06:47 UTC 2019

Modified Files:
src/share/man/man4: sb.4

Log Message:
pnpbios.4 is in i386


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/share/man/man4/sb.4

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/man4/sb.4
diff -u src/share/man/man4/sb.4:1.25 src/share/man/man4/sb.4:1.26
--- src/share/man/man4/sb.4:1.25	Wed Apr 30 13:10:54 2008
+++ src/share/man/man4/sb.4	Mon Aug  5 15:06:47 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sb.4,v 1.25 2008/04/30 13:10:54 martin Exp $
+.\"	$NetBSD: sb.4,v 1.26 2019/08/05 15:06:47 ryoon Exp $
 .\"
 .\" Copyright (c) 1996 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -92,7 +92,7 @@ has a midi device attached directly to t
 .Xr midi 4 ,
 .Xr mpu 4 ,
 .Xr opl 4 ,
-.Xr pnpbios 4
+.Xr i386/pnpbios 4
 .Sh HISTORY
 The
 .Nm



CVS commit: src/share/man/man4

2019-08-05 Thread Ryo ONODERA
Module Name:src
Committed By:   ryoon
Date:   Mon Aug  5 15:06:47 UTC 2019

Modified Files:
src/share/man/man4: sb.4

Log Message:
pnpbios.4 is in i386


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/share/man/man4/sb.4

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



CVS commit: [netbsd-8] src/doc

2019-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  5 14:48:29 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Adjust ticket #1324


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/doc/CHANGES-8.2

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



CVS commit: [netbsd-8] src/doc

2019-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  5 14:48:29 UTC 2019

Modified Files:
src/doc [netbsd-8]: CHANGES-8.2

Log Message:
Adjust ticket #1324


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.18 -r1.1.2.19 src/doc/CHANGES-8.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-8.2
diff -u src/doc/CHANGES-8.2:1.1.2.18 src/doc/CHANGES-8.2:1.1.2.19
--- src/doc/CHANGES-8.2:1.1.2.18	Sun Aug  4 11:30:39 2019
+++ src/doc/CHANGES-8.2	Mon Aug  5 14:48:29 2019
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-8.2,v 1.1.2.18 2019/08/04 11:30:39 martin Exp $
+# $NetBSD: CHANGES-8.2,v 1.1.2.19 2019/08/05 14:48:29 martin Exp $
 
 A complete list of changes from the NetBSD 8.1 release to the NetBSD 8.2
 release:
@@ -473,7 +473,7 @@ sys/net/bpf.c	1.229
 	Fix info leak: use kmem_zalloc to clear uninitialized padding.
 	[maxv, ticket #1323]
 
-sys/kern/kern_exec.c1.469-1.478 (patch)
+sys/kern/kern_exec.c1.469-1.476,1.478 (patch)
 
 	Fix off-by-one and info leak.
 	[maxv, ticket #1324]



CVS commit: [netbsd-8] src/sys/kern

2019-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  5 14:47:49 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: kern_exec.c

Log Message:
Fix editor mistake in previous


To generate a diff of this commit:
cvs rdiff -u -r1.442.4.6 -r1.442.4.7 src/sys/kern/kern_exec.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/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.442.4.6 src/sys/kern/kern_exec.c:1.442.4.7
--- src/sys/kern/kern_exec.c:1.442.4.6	Mon Aug  5 14:43:54 2019
+++ src/sys/kern/kern_exec.c	Mon Aug  5 14:47:49 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.442.4.6 2019/08/05 14:43:54 martin Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.442.4.7 2019/08/05 14:47:49 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.442.4.6 2019/08/05 14:43:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.442.4.7 2019/08/05 14:47:49 martin Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -677,7 +677,7 @@ execve_loadvm(struct lwp *l, const char 
 	struct proc		*p;
 	char			*dp;
 	u_int			modgen;
-	size_t			offss = 0;	// XXX: GCC
+	size_t			offs = 0;	// XXX: GCC
 
 	KASSERT(data != NULL);
 



CVS commit: [netbsd-8] src/sys/kern

2019-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  5 14:47:49 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: kern_exec.c

Log Message:
Fix editor mistake in previous


To generate a diff of this commit:
cvs rdiff -u -r1.442.4.6 -r1.442.4.7 src/sys/kern/kern_exec.c

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



Re: CVS commit: src/sys/dev/acpi

2019-08-05 Thread Joerg Sonnenberger
On Mon, Aug 05, 2019 at 10:12:04AM +, SAITOH Masanobu wrote:
> Module Name:  src
> Committed By: msaitoh
> Date: Mon Aug  5 10:12:04 UTC 2019
> 
> Modified Files:
>   src/sys/dev/acpi: acpi_ec.c
> 
> Log Message:
> - Fix a bug that acpiec_space_handler() doesn't access more than 64bit
>   correctly. Found by kUBSan on Thinkpad X220. acpiec0 accessed 128bits from
>   address 0xa0. The error message was:
> 
>   UBSan: Undefined Behavior in ../../../../dev/acpi/acpi_ec.c:672:32, 
> shift exponent 64 is too large for 64-bit type 'long unsigned int'

Ignore all the gracious changes that make the diff harder to read than
necessary, doesn't this break the case of width == 0?

Joerg


CVS commit: [netbsd-8] src/sys/kern

2019-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  5 14:43:54 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: kern_exec.c

Log Message:
Backout the pullup of r1.476:

remove offs initialization and XXX gcc comment.

While actually the "offs" variable is always initialized when used, the
gcc version on this branch is not smart enough to recognize that.


To generate a diff of this commit:
cvs rdiff -u -r1.442.4.5 -r1.442.4.6 src/sys/kern/kern_exec.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/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.442.4.5 src/sys/kern/kern_exec.c:1.442.4.6
--- src/sys/kern/kern_exec.c:1.442.4.5	Sun Aug  4 11:25:43 2019
+++ src/sys/kern/kern_exec.c	Mon Aug  5 14:43:54 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.442.4.5 2019/08/04 11:25:43 martin Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.442.4.6 2019/08/05 14:43:54 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.442.4.5 2019/08/04 11:25:43 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.442.4.6 2019/08/05 14:43:54 martin Exp $");
 
 #include "opt_exec.h"
 #include "opt_execfmt.h"
@@ -677,7 +677,7 @@ execve_loadvm(struct lwp *l, const char 
 	struct proc		*p;
 	char			*dp;
 	u_int			modgen;
-	size_t			offs;
+	size_t			offss = 0;	// XXX: GCC
 
 	KASSERT(data != NULL);
 



CVS commit: [netbsd-8] src/sys/kern

2019-08-05 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Mon Aug  5 14:43:54 UTC 2019

Modified Files:
src/sys/kern [netbsd-8]: kern_exec.c

Log Message:
Backout the pullup of r1.476:

remove offs initialization and XXX gcc comment.

While actually the "offs" variable is always initialized when used, the
gcc version on this branch is not smart enough to recognize that.


To generate a diff of this commit:
cvs rdiff -u -r1.442.4.5 -r1.442.4.6 src/sys/kern/kern_exec.c

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



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:50:58 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: sbc_encode.c

Log Message:
Consistent indentation / whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.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/bta2dpd/bta2dpd/sbc_encode.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.8 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.9
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.8	Mon Aug  5 13:49:10 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Mon Aug  5 13:50:58 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.8 2019/08/05 13:49:10 maya Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.9 2019/08/05 13:50:58 maya Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -983,7 +983,6 @@ recvstream(int in, int outfd)
 		return -1;
 	}
 
-
 	myFrame = frameData + sizeof(myHeader);
 	next_pkt = 0;
 	pkt_len = 0;
@@ -1002,7 +1001,7 @@ recvstream(int in, int outfd)
 	res = (ssize_t)(sizeof(myHeader)) + next_pkt;
 		readlen -= res;
 	if (readlen > 0)
-			memcpy(frameData, frameData + res, (size_t)readlen);
+		memcpy(frameData, frameData + res, (size_t)readlen);
 
 send_again:
 	len = write(outfd, music, totalSize);



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:50:58 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: sbc_encode.c

Log Message:
Consistent indentation / whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c

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



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:49:10 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: sbc_encode.c

Log Message:
KNF for loops


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.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/bta2dpd/bta2dpd/sbc_encode.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.7 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.8
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.7	Mon Aug  5 13:45:01 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Mon Aug  5 13:49:10 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.7 2019/08/05 13:45:01 maya Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.8 2019/08/05 13:49:10 maya Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -162,7 +162,7 @@ calc_scalefactors_joint(int32_t sb_sampl
 	unsigned int joint;
 
 	joint = 0;
-	for (sb = 0;sb < global_bands - 1;sb++) {
+	for (sb = 0; sb < global_bands - 1; sb++) {
 		for (block = 0; block < global_blocks; block++) {
 			sb_j[block][0] = (sb_sample[block][0][sb]) +
 			(sb_sample[block][1][sb]);
@@ -254,8 +254,8 @@ next_chan:
 	slicecount=0;
 
 	if (global_alloc == ALLOC_SNR) {
-		for (ch = start_chan;ch < global_chan;ch++) {
-			for (sb = 0;sb < global_bands;sb++) {
+		for (ch = start_chan; ch < global_chan; ch++) {
+			for (sb = 0; sb < global_bands; sb++) {
 bitneed[ch][sb] = (int32_t)scalefactor[ch][sb];
 
 if (bitneed[ch][sb] > max_bitneed)
@@ -263,8 +263,8 @@ next_chan:
 			}
 		}
 	} else {
-		for (ch = start_chan;ch < global_chan;ch++) {
-			for (sb = 0;sb < global_bands;sb++) {
+		for (ch = start_chan; ch < global_chan; ch++) {
+			for (sb = 0; sb < global_bands; sb++) {
 if (scalefactor[ch][sb] == 0)
 	bitneed[ch][sb] = -5;
 else {
@@ -296,8 +296,8 @@ next_chan:
 		bitslice--;
 		bitcount += slicecount;
 		slicecount = 0;
-		for (ch = start_chan;ch < global_chan;ch++) {
-			for (sb = 0;sb < global_bands;sb++) {
+		for (ch = start_chan; ch < global_chan; ch++) {
+			for (sb = 0; sb < global_bands; sb++) {
 if((bitneed[ch][sb] > bitslice + 1)&&
 (bitneed[ch][sb] < bitslice + 16))
 	slicecount++;
@@ -311,8 +311,8 @@ next_chan:
 		bitslice--;
 	}
 
-	for (ch = start_chan;ch < global_chan;ch++) {
-		for (sb = 0;sb < global_bands;sb++) {
+	for (ch = start_chan; ch < global_chan; ch++) {
+		for (sb = 0; sb < global_bands; sb++) {
 			if (bitneed[ch][sb] < bitslice + 2)
 bits[ch][sb] = 0;
 			else {
@@ -555,8 +555,8 @@ sbc_encode(int16_t *input, int32_t *samp
 
 	calc_bitneed();
 
-	for(chan = 0;chan < global_chan;chan++) {
-		for (sb = 0; sb < global_bands;sb++) {
+	for(chan = 0; chan < global_chan; chan++) {
+		for (sb = 0; sb < global_bands; sb++) {
 			levels[chan][sb] = ((1 << bits[chan][sb]) - 1) <<
 (15 - scalefactor[chan][sb]);
 			delta[chan][sb] = 1 << (scalefactor[chan][sb] + 16);
@@ -592,8 +592,8 @@ sbc_decode(int32_t *samples, int16_t *pc
 	int chan, block, sb, position, i, k;
 	size_t numsamples;
 
-	for(chan = 0;chan < global_chan;chan++) {
-		for (sb = 0; sb < global_bands;sb++) {
+	for(chan = 0; chan < global_chan; chan++) {
+		for (sb = 0; sb < global_bands; sb++) {
 			levels[chan][sb] = (1 << bits[chan][sb]) - 1;
 			delta[chan][sb] = 1 << (scalefactor[chan][sb] + 1);
 		}
@@ -620,7 +620,7 @@ sbc_decode(int32_t *samples, int16_t *pc
 	if (global_mode == MODE_JOINT) {
 		k = 0;
 		while (k < (global_blocks * global_bands * global_chan)) {
-			for (sb = 0; sb < global_bands;sb++) {
+			for (sb = 0; sb < global_bands; sb++) {
 if (join & 1 << (global_bands - sb - 1)) {
 	audioout = samples[k];
 	samples[k] = (2 * samples[k]) + (2 *
@@ -639,7 +639,7 @@ sbc_decode(int32_t *samples, int16_t *pc
 
 
 	position = 0;
-	for (block = 0;block < global_blocks; block++) {
+	for (block = 0; block < global_blocks; block++) {
 		for (chan = 0; chan < global_chan; chan++) {
 			if (chan == 0)
 X = L;



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:49:10 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: sbc_encode.c

Log Message:
KNF for loops


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c

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



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:45:01 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: sbc_encode.c

Log Message:
Remove duplicate check for curpkt > 13

We already guarantee this above:
if (numpkts < 1 || numpkts > 13) {
return -1;


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c

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



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:45:01 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: sbc_encode.c

Log Message:
Remove duplicate check for curpkt > 13

We already guarantee this above:
if (numpkts < 1 || numpkts > 13) {
return -1;


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.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/bta2dpd/bta2dpd/sbc_encode.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.6 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.7
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.6	Sat Jul 27 23:33:09 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Mon Aug  5 13:45:01 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.6 2019/07/27 23:33:09 maya Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.7 2019/08/05 13:45:01 maya Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -997,9 +997,6 @@ recvstream(int in, int outfd)
 		totalSize += 2 * decsize;
 		offset += decsize;
 		cur_pkt++;
-
-		if (cur_pkt > 13)
-			break;
 	}
 
 	res = (ssize_t)(sizeof(myHeader)) + next_pkt;



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:39:19 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: avdtp.c

Log Message:
Avoid read overflows


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/usr.sbin/bta2dpd/bta2dpd/avdtp.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/bta2dpd/bta2dpd/avdtp.c
diff -u src/usr.sbin/bta2dpd/bta2dpd/avdtp.c:1.2 src/usr.sbin/bta2dpd/bta2dpd/avdtp.c:1.3
--- src/usr.sbin/bta2dpd/bta2dpd/avdtp.c:1.2	Wed Jul 25 19:03:50 2018
+++ src/usr.sbin/bta2dpd/bta2dpd/avdtp.c	Mon Aug  5 13:39:18 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: avdtp.c,v 1.2 2018/07/25 19:03:50 kamil Exp $ */
+/* $NetBSD: avdtp.c,v 1.3 2019/08/05 13:39:18 maya Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -210,7 +210,7 @@ avdtpDiscover(uint8_t *buffer, size_t re
 	bool isSink;
 
 	if (recvsize >= 2) {
-		for (offset = 0;offset < recvsize;offset += 2) {
+		for (offset = 0; offset < recvsize - 1; offset += 2) {
 			sepInfo->sep = buffer[offset] >> 2;
 			sepInfo->media_Type = buffer[offset+1] >> 4;
 			isSink = (buffer[offset+1] >> 3) & 1;
@@ -313,7 +313,7 @@ avdtpAutoConfigSBC(int fd, int recvfd, u
 	uint8_t supBitpoolMin, supBitpoolMax, tmp_mask;
 	size_t i;
 
-	for (i = 0; i < cap_len; i++) {
+	for (i = 0; i < cap_len - 5; i++) {
 		if (capabilities[i] == mediaTransport &&
 		capabilities[i + 1] == 0 &&
 		capabilities[i + 2] == mediaCodec &&
@@ -321,7 +321,7 @@ avdtpAutoConfigSBC(int fd, int recvfd, u
 		capabilities[i + 5] == SBC_CODEC_ID)
 			break;
 	}
-	if (i >= cap_len)
+	if (i >= cap_len - 9)
 		goto auto_config_failed;
 
 	availFreqMode = capabilities[i + 6];



CVS commit: src/usr.sbin/bta2dpd/bta2dpd

2019-08-05 Thread Maya Rashish
Module Name:src
Committed By:   maya
Date:   Mon Aug  5 13:39:19 UTC 2019

Modified Files:
src/usr.sbin/bta2dpd/bta2dpd: avdtp.c

Log Message:
Avoid read overflows


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

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



CVS commit: src/sys/net

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 13:30:21 UTC 2019

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

Log Message:
 Cast uint32_t to avoid undefined behavior in bridge_rthash(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 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.



CVS commit: src/sys/net

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 13:30:21 UTC 2019

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

Log Message:
 Cast uint32_t to avoid undefined behavior in bridge_rthash(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.164 -r1.165 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.164 src/sys/net/if_bridge.c:1.165
--- src/sys/net/if_bridge.c:1.164	Sat Dec 22 04:28:30 2018
+++ src/sys/net/if_bridge.c	Mon Aug  5 13:30:21 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_bridge.c,v 1.164 2018/12/22 04:28:30 rin Exp $	*/
+/*	$NetBSD: if_bridge.c,v 1.165 2019/08/05 13:30:21 msaitoh Exp $	*/
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.164 2018/12/22 04:28:30 rin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.165 2019/08/05 13:30:21 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -2517,7 +2517,7 @@ bridge_rthash(struct bridge_softc *sc, c
 
 	b += addr[5] << 8;
 	b += addr[4];
-	a += addr[3] << 24;
+	a += (uint32_t)addr[3] << 24;
 	a += addr[2] << 16;
 	a += addr[1] << 8;
 	a += addr[0];



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 13:28:31 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h

Log Message:
 Use unsigned to avoid undefined behavior in gen7_get_stolen_reserved().
Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.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/dist/drm/i915

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 13:28:31 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h

Log Message:
 Use unsigned to avoid undefined behavior in gen7_get_stolen_reserved().
Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.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/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.8 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.9
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.8	Mon Aug  5 10:14:19 2019
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Mon Aug  5 13:28:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_reg.h,v 1.8 2019/08/05 10:14:19 msaitoh Exp $	*/
+/*	$NetBSD: i915_reg.h,v 1.9 2019/08/05 13:28:31 msaitoh Exp $	*/
 
 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -185,7 +185,7 @@
 
 #define GEN6_STOLEN_RESERVED		0x1082C0
 #define GEN6_STOLEN_RESERVED_ADDR_MASK	(0xFFFUL << 20)
-#define GEN7_STOLEN_RESERVED_ADDR_MASK	(0x3FFF << 18)
+#define GEN7_STOLEN_RESERVED_ADDR_MASK	(0x3FFFUL << 18)
 #define GEN6_STOLEN_RESERVED_SIZE_MASK	(3 << 4)
 #define GEN6_STOLEN_RESERVED_1M		(0 << 4)
 #define GEN6_STOLEN_RESERVED_512K	(1 << 4)



CVS commit: src/sys/arch/arm/imx/fdt

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:44:01 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_platform.c

Log Message:
Add "fsl,imx6qp" (i.MX6QP) to ARM_PLATFORM list.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/imx6_platform.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/imx/fdt/imx6_platform.c
diff -u src/sys/arch/arm/imx/fdt/imx6_platform.c:1.4 src/sys/arch/arm/imx/fdt/imx6_platform.c:1.5
--- src/sys/arch/arm/imx/fdt/imx6_platform.c:1.4	Sat Jul 27 07:41:43 2019
+++ src/sys/arch/arm/imx/fdt/imx6_platform.c	Mon Aug  5 12:44:01 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_platform.c,v 1.4 2019/07/27 07:41:43 skrll Exp $	*/
+/*	$NetBSD: imx6_platform.c,v 1.5 2019/08/05 12:44:01 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.4 2019/07/27 07:41:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_platform.c,v 1.5 2019/08/05 12:44:01 hkenken Exp $");
 
 #include "arml2cc.h"
 #include "opt_console.h"
@@ -196,5 +196,6 @@ const struct arm_platform imx6_platform 
 	.ap_mpstart = imx_platform_mpstart,
 };
 
-ARM_PLATFORM(imx6, "fsl,imx6q", &imx6_platform);
+ARM_PLATFORM(imx6q, "fsl,imx6q", &imx6_platform);
+ARM_PLATFORM(imx6qp, "fsl,imx6qp", &imx6_platform);
 



CVS commit: src/sys/arch/arm/imx/fdt

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:44:01 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_platform.c

Log Message:
Add "fsl,imx6qp" (i.MX6QP) to ARM_PLATFORM list.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/imx/fdt/imx6_platform.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/evbarm/netwalker

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:30:13 UTC 2019

Modified Files:
src/sys/arch/evbarm/netwalker: netwalker_usb.c

Log Message:
Remove debug print message.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/netwalker/netwalker_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/arch/evbarm/netwalker/netwalker_usb.c
diff -u src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.6 src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.7
--- src/sys/arch/evbarm/netwalker/netwalker_usb.c:1.6	Wed Jul 24 12:33:18 2019
+++ src/sys/arch/evbarm/netwalker/netwalker_usb.c	Mon Aug  5 12:30:13 2019
@@ -25,7 +25,7 @@
  *
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.6 2019/07/24 12:33:18 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netwalker_usb.c,v 1.7 2019/08/05 12:30:13 hkenken Exp $");
 
 #include "locators.h"
 
@@ -77,10 +77,9 @@ imxusbc_match(device_t parent, cfdata_t 
 {
 	struct axi_attach_args *aa = aux;
 
-	printf("%s\n", __func__);
-
 	if (aa->aa_addr == USBOH3_BASE)
 		return 1;
+
 	return 0;
 }
 
@@ -90,7 +89,7 @@ imxusbc_attach(device_t parent, device_t
 	struct imxusbc_softc *sc = device_private(self);
 	struct axi_attach_args *aa = aux;
 
-	aprint_normal("\n");
+	aprint_naive("\n");
 	aprint_normal(": Universal Serial Bus Controller\n");
 
 	if (aa->aa_size == AXICF_SIZE_DEFAULT)



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

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:30:13 UTC 2019

Modified Files:
src/sys/arch/evbarm/netwalker: netwalker_usb.c

Log Message:
Remove debug print message.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/netwalker/netwalker_usb.c

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



CVS commit: src/sys

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:21:00 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_i2c.c
src/sys/dev/i2c: motoi2c.c motoi2cvar.h

Log Message:
Add support FDT.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_i2c.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/motoi2c.c \
src/sys/dev/i2c/motoi2cvar.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/arm/imx/fdt/imx6_i2c.c
diff -u src/sys/arch/arm/imx/fdt/imx6_i2c.c:1.1 src/sys/arch/arm/imx/fdt/imx6_i2c.c:1.2
--- src/sys/arch/arm/imx/fdt/imx6_i2c.c:1.1	Tue Jul 30 06:52:57 2019
+++ src/sys/arch/arm/imx/fdt/imx6_i2c.c	Mon Aug  5 12:21:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: imx6_i2c.c,v 1.1 2019/07/30 06:52:57 hkenken Exp $	*/
+/*	$NetBSD: imx6_i2c.c,v 1.2 2019/08/05 12:21:00 hkenken Exp $	*/
 /*-
  * Copyright (c) 2019 Genetec Corporation.  All rights reserved.
  * Written by Hashimoto Kenichi for Genetec Corporation.
@@ -25,7 +25,7 @@
  * SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: imx6_i2c.c,v 1.1 2019/07/30 06:52:57 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx6_i2c.c,v 1.2 2019/08/05 12:21:00 hkenken Exp $");
 
 #include 
 
@@ -75,6 +75,9 @@ imxi2c_attach(device_t parent __unused, 
 	if (error)
 		freq = 10;
 	imxi2c_set_freq(self, clk_get_rate(sc->sc_clk), freq);
+
+	sc->sc_motoi2c.sc_phandle = phandle;
+
 	imxi2c_attach_common(parent, self, bst, addr, size, -1, 0);
 }
 

Index: src/sys/dev/i2c/motoi2c.c
diff -u src/sys/dev/i2c/motoi2c.c:1.4 src/sys/dev/i2c/motoi2c.c:1.5
--- src/sys/dev/i2c/motoi2c.c:1.4	Sun Apr 17 15:14:59 2011
+++ src/sys/dev/i2c/motoi2c.c	Mon Aug  5 12:21:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: motoi2c.c,v 1.4 2011/04/17 15:14:59 phx Exp $ */
+/* $NetBSD: motoi2c.c,v 1.5 2019/08/05 12:21:00 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,11 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: motoi2c.c,v 1.4 2011/04/17 15:14:59 phx Exp $");
+__KERNEL_RCSID(0, "$NetBSD: motoi2c.c,v 1.5 2019/08/05 12:21:00 hkenken Exp $");
+
+#if defined(__arm__) || defined(__aarch64__)
+#include "opt_fdt.h"
+#endif
 
 #include 
 #include 
@@ -43,6 +47,10 @@ __KERNEL_RCSID(0, "$NetBSD: motoi2c.c,v 
 #include 
 #include 
 
+#ifdef FDT
+#include 
+#endif
+
 #ifdef DEBUG
 int motoi2c_debug = 0;
 #define	DPRINTF(x)	if (motoi2c_debug) printf x
@@ -50,6 +58,20 @@ int motoi2c_debug = 0;
 #define	DPRINTF(x)
 #endif
 
+#ifdef FDT
+static i2c_tag_t
+motoi2c_get_tag(device_t dev)
+{
+	struct motoi2c_softc * const sc = device_private(dev);
+
+	return &sc->sc_i2c;
+}
+
+static const struct fdtbus_i2c_controller_func motoi2c_funcs = {
+	.get_tag = motoi2c_get_tag,
+};
+#endif
+
 static int  motoi2c_acquire_bus(void *, int);
 static void motoi2c_release_bus(void *, int);
 static int  motoi2c_exec(void *, i2c_op_t, i2c_addr_t, const void *, size_t,
@@ -111,7 +133,14 @@ motoi2c_attach_common(device_t self, str
 	I2C_WRITE(I2CADR, i2c->i2c_adr);	/* our slave address is 0x7f */
 	I2C_WRITE(I2CSR, 0);		/* clear status flags */
 
+#ifdef FDT
+	KASSERT(sc->sc_phandle != 0);
+	fdtbus_register_i2c_controller(self, sc->sc_phandle, &motoi2c_funcs);
+
+	fdtbus_attach_i2cbus(self, sc->sc_phandle, &sc->sc_i2c, iicbus_print);
+#else
 	config_found_ia(self, "i2cbus", &iba, iicbus_print);
+#endif
 }
 
 static int
Index: src/sys/dev/i2c/motoi2cvar.h
diff -u src/sys/dev/i2c/motoi2cvar.h:1.4 src/sys/dev/i2c/motoi2cvar.h:1.5
--- src/sys/dev/i2c/motoi2cvar.h:1.4	Sun Apr 17 15:14:59 2011
+++ src/sys/dev/i2c/motoi2cvar.h	Mon Aug  5 12:21:00 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: motoi2cvar.h,v 1.4 2011/04/17 15:14:59 phx Exp $ */
+/* $NetBSD: motoi2cvar.h,v 1.5 2019/08/05 12:21:00 hkenken Exp $ */
 
 /*-
  * Copyright (c) 2007, 2010 The NetBSD Foundation, Inc.
@@ -51,6 +51,7 @@ struct motoi2c_softc {
 	kmutex_t		sc_buslock;
 	motoi2c_iord_t		sc_iord;
 	motoi2c_iowr_t		sc_iowr;
+	int			sc_phandle;
 };
 
 #define	MOTOI2C_ADR_DEFAULT	(0x7e << 1)



CVS commit: src/sys

2019-08-05 Thread Kenichi Hashimoto
Module Name:src
Committed By:   hkenken
Date:   Mon Aug  5 12:21:00 UTC 2019

Modified Files:
src/sys/arch/arm/imx/fdt: imx6_i2c.c
src/sys/dev/i2c: motoi2c.c motoi2cvar.h

Log Message:
Add support FDT.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/imx/fdt/imx6_i2c.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/motoi2c.c \
src/sys/dev/i2c/motoi2cvar.h

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



Re: CVS commit: src/sys/dev/acpi

2019-08-05 Thread SAITOH Masanobu
On 2019/08/05 19:12, SAITOH Masanobu wrote:
> Module Name:  src
> Committed By: msaitoh
> Date: Mon Aug  5 10:12:04 UTC 2019
> 
> Modified Files:
>   src/sys/dev/acpi: acpi_ec.c
> 
> Log Message:
> - Fix a bug that acpiec_space_handler() doesn't access more than 64bit
>   correctly. Found by kUBSan on Thinkpad X220. acpiec0 accessed 128bits from

s/acpi0/acpiecdt0/

>   address 0xa0. The error message was:
> 
>   UBSan: Undefined Behavior in ../../../../dev/acpi/acpi_ec.c:672:32, 
> shift exponent 64 is too large for 64-bit type 'long unsigned int'
> 
> - KNF.
> The error message was:
> 
> 
> To generate a diff of this commit:
> cvs rdiff -u -r1.75 -r1.76 src/sys/dev/acpi/acpi_ec.c
> 
> Please note that diffs are not public domain; they are subject to the
> copyright notices on the relevant files.
> 


-- 
---
SAITOH Masanobu (msai...@execsw.org
 msai...@netbsd.org)


CVS commit: src/sys/netinet6

2019-08-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  5 10:25:41 UTC 2019

Modified Files:
src/sys/netinet6: in6_offload.h

Log Message:
add forward decl


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/netinet6/in6_offload.h

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



CVS commit: src/sys/netinet6

2019-08-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Aug  5 10:25:41 UTC 2019

Modified Files:
src/sys/netinet6: in6_offload.h

Log Message:
add forward decl


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/netinet6/in6_offload.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/netinet6/in6_offload.h
diff -u src/sys/netinet6/in6_offload.h:1.10 src/sys/netinet6/in6_offload.h:1.11
--- src/sys/netinet6/in6_offload.h:1.10	Tue Dec 11 20:40:20 2018
+++ src/sys/netinet6/in6_offload.h	Mon Aug  5 06:25:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6_offload.h,v 1.10 2018/12/12 01:40:20 rin Exp $	*/
+/*	$NetBSD: in6_offload.h,v 1.11 2019/08/05 10:25:41 christos Exp $	*/
 
 /*
  * Copyright (c)2005, 2006 YAMAMOTO Takashi,
@@ -33,6 +33,7 @@
  * Subroutines to do software-only equivalent of h/w offloading.
  */
 struct mbuf *tcp6_segment(struct mbuf *, int);
+struct sockaddr_in6;
 int ip6_tso_output(struct ifnet *, struct ifnet *, struct mbuf *,
 const struct sockaddr_in6 *, struct rtentry *);
 void in6_undefer_cksum(struct mbuf *, size_t, int);



CVS commit: src/sys/external/bsd/drm2/dist/drm/i915

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 10:14:19 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h intel_pm.c

Log Message:
 Avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.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/dist/drm/i915

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 10:14:19 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: i915_reg.h intel_pm.c

Log Message:
 Avoid undefined behavior. Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h
cvs rdiff -u -r1.17 -r1.18 src/sys/external/bsd/drm2/dist/drm/i915/intel_pm.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/dist/drm/i915/i915_reg.h
diff -u src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7 src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.8
--- src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h:1.7	Wed Jul 24 15:55:07 2019
+++ src/sys/external/bsd/drm2/dist/drm/i915/i915_reg.h	Mon Aug  5 10:14:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i915_reg.h,v 1.7 2019/07/24 15:55:07 msaitoh Exp $	*/
+/*	$NetBSD: i915_reg.h,v 1.8 2019/08/05 10:14:19 msaitoh Exp $	*/
 
 /* Copyright 2003 Tungsten Graphics, Inc., Cedar Park, Texas.
  * All Rights Reserved.
@@ -2225,7 +2225,7 @@ enum skl_disp_power_wells {
 #define   VGA1_PD_P1_DIV_2	(1 << 13)
 #define   VGA1_PD_P1_SHIFT	8
 #define   VGA1_PD_P1_MASK	(0x1f << 8)
-#define   DPLL_VCO_ENABLE		(1 << 31)
+#define   DPLL_VCO_ENABLE		__BIT(31)
 #define   DPLL_SDVO_HIGH_SPEED		(1 << 30)
 #define   DPLL_DVO_2X_MODE		(1 << 30)
 #define   DPLL_EXT_BUFFER_ENABLE_VLV	(1 << 30)
@@ -3175,7 +3175,7 @@ enum skl_disp_power_wells {
 #define PCH_ADPA0xe1100
 #define VLV_ADPA		(VLV_DISPLAY_BASE + ADPA)
 
-#define   ADPA_DAC_ENABLE	(1<<31)
+#define   ADPA_DAC_ENABLE	__BIT(31)
 #define   ADPA_DAC_DISABLE	0
 #define   ADPA_PIPE_SELECT_MASK	(1<<30)
 #define   ADPA_PIPE_A_SELECT	0
@@ -3337,7 +3337,7 @@ enum skl_disp_power_wells {
 #define   PIPE_A_SCRAMBLE_RESET			(1 << 0)
 
 /* Gen 3 SDVO bits: */
-#define   SDVO_ENABLE(1 << 31)
+#define   SDVO_ENABLE__BIT(31)
 #define   SDVO_PIPE_SEL(pipe)			((pipe) << 30)
 #define   SDVO_PIPE_SEL_MASK			(1 << 30)
 #define   SDVO_PIPE_B_SELECT			(1 << 30)
@@ -3428,7 +3428,7 @@ enum skl_disp_power_wells {
  * Enables the LVDS port.  This bit must be set before DPLLs are enabled, as
  * the DPLL semantics change when the LVDS is assigned to that pipe.
  */
-#define   LVDS_PORT_EN			(1 << 31)
+#define   LVDS_PORT_EN			(1U << 31)
 /* Selects pipe B for LVDS data.  Must be set on pre-965. */
 #define   LVDS_PIPEB_SELECT		(1 << 30)
 #define   LVDS_PIPE_MASK		(1 << 30)
@@ -3588,7 +3588,7 @@ enum skl_disp_power_wells {
 
 /* Backlight control */
 #define BLC_PWM_CTL2	(dev_priv->info.display_mmio_offset + 0x61250) /* 965+ only */
-#define   BLM_PWM_ENABLE		(1 << 31)
+#define   BLM_PWM_ENABLE		__BIT(31)
 #define   BLM_COMBINATION_MODE		(1 << 30) /* gen4 only */
 #define   BLM_PIPE_SELECT		(1 << 29)
 #define   BLM_PIPE_SELECT_IVB		(3 << 29)
@@ -3645,7 +3645,7 @@ enum skl_disp_power_wells {
 /* PCH CTL1 is totally different, all but the below bits are reserved. CTL2 is
  * like the normal CTL from gen4 and earlier. Hooray for confusing naming. */
 #define BLC_PWM_PCH_CTL1	0xc8250
-#define   BLM_PCH_PWM_ENABLE			(1 << 31)
+#define   BLM_PCH_PWM_ENABLE			__BIT(31)
 #define   BLM_PCH_OVERRIDE_ENABLE		(1 << 30)
 #define   BLM_PCH_POLARITY			(1 << 29)
 #define BLC_PWM_PCH_CTL2	0xc8254
@@ -4166,7 +4166,7 @@ enum skl_disp_power_wells {
 #define VLV_DP_C			(VLV_DISPLAY_BASE + DP_C)
 #define CHV_DP_D			(VLV_DISPLAY_BASE + DP_D)
 
-#define   DP_PORT_EN			(1 << 31)
+#define   DP_PORT_EN			__BIT(31)
 #define   DP_PIPEB_SELECT		(1 << 30)
 #define   DP_PIPE_MASK			(1 << 30)
 #define   DP_PIPE_SELECT_CHV(pipe)	((pipe) << 16)
@@ -5052,7 +5052,7 @@ enum skl_disp_power_wells {
 
 /* Sprite A control */
 #define _DVSACNTR		0x72180
-#define   DVS_ENABLE		(1<<31)
+#define   DVS_ENABLE		__BIT(31)
 #define   DVS_GAMMA_ENABLE	(1<<30)
 #define   DVS_PIXFORMAT_MASK	(3<<25)
 #define   DVS_FORMAT_YUV422	(0<<25)
@@ -5459,7 +5459,7 @@ enum skl_disp_power_wells {
 
 /* VBIOS regs */
 #define VGACNTRL		0x71400
-# define VGA_DISP_DISABLE			(1 << 31)
+# define VGA_DISP_DISABLE			__BIT(31)
 # define VGA_2X_MODE(1 << 30)
 # define VGA_PIPE_B_SELECT			(1 << 29)
 
@@ -6367,7 +6367,7 @@ enum skl_disp_power_wells {
 #define PCH_TRANSCONF(pipe) _PIPE(pipe, _PCH_TRANSACONF, _PCH_TRANSBCONF)
 #define LPT_TRANSCONF		_PCH_TRANSACONF /* lpt has only one transcoder */
 #define  TRANS_DISABLE  (0<<31)
-#define  TRANS_ENABLE   (1<<31)
+#define  TRANS_ENABLE   __BIT(31)
 #define  TRANS_STATE_MASK   (1<<30)
 #define  TRANS_STATE_DISABLE(0<<30)
 #define  TRANS_STATE_ENABLE (1<<30)
@@ -6392,7 +6392,7 @@ enum skl_disp_power_wells {
 #define _TRANSA_CHICKEN2	 0xf0064
 #define _TRANSB_CHICKEN2	 0xf1064
 #define TRANS_CHICKEN2(pipe) _PIPE(pipe, _TRANSA_CHICKEN2, _TRANSB_CHICKEN2)
-#define  TRANS_CHICKEN2_TIMING_OVERRIDE			(1<<31)
+#define  TRANS_CHICKEN2_TIMING_OVERRIDE			__BIT(31)
 #define 

CVS commit: src/sys/dev/acpi

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 10:12:04 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_ec.c

Log Message:
- Fix a bug that acpiec_space_handler() doesn't access more than 64bit
  correctly. Found by kUBSan on Thinkpad X220. acpiec0 accessed 128bits from
  address 0xa0. The error message was:

UBSan: Undefined Behavior in ../../../../dev/acpi/acpi_ec.c:672:32, 
shift exponent 64 is too large for 64-bit type 'long unsigned int'

- KNF.
The error message was:


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/acpi/acpi_ec.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/acpi

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 10:12:04 UTC 2019

Modified Files:
src/sys/dev/acpi: acpi_ec.c

Log Message:
- Fix a bug that acpiec_space_handler() doesn't access more than 64bit
  correctly. Found by kUBSan on Thinkpad X220. acpiec0 accessed 128bits from
  address 0xa0. The error message was:

UBSan: Undefined Behavior in ../../../../dev/acpi/acpi_ec.c:672:32, 
shift exponent 64 is too large for 64-bit type 'long unsigned int'

- KNF.
The error message was:


To generate a diff of this commit:
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/acpi/acpi_ec.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/acpi/acpi_ec.c
diff -u src/sys/dev/acpi/acpi_ec.c:1.75 src/sys/dev/acpi/acpi_ec.c:1.76
--- src/sys/dev/acpi/acpi_ec.c:1.75	Sat Mar 11 08:26:23 2017
+++ src/sys/dev/acpi/acpi_ec.c	Mon Aug  5 10:12:04 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: acpi_ec.c,v 1.75 2017/03/11 08:26:23 tsutsui Exp $	*/
+/*	$NetBSD: acpi_ec.c,v 1.76 2019/08/05 10:12:04 msaitoh Exp $	*/
 
 /*-
  * Copyright (c) 2007 Joerg Sonnenberger .
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.75 2017/03/11 08:26:23 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_ec.c,v 1.76 2019/08/05 10:12:04 msaitoh Exp $");
 
 #include 
 #include 
@@ -404,6 +404,7 @@ post_data_map:
 static bool
 acpiec_suspend(device_t dv, const pmf_qual_t *qual)
 {
+
 	acpiec_cold = true;
 
 	return true;
@@ -412,6 +413,7 @@ acpiec_suspend(device_t dv, const pmf_qu
 static bool
 acpiec_resume(device_t dv, const pmf_qual_t *qual)
 {
+
 	acpiec_cold = false;
 
 	return true;
@@ -454,9 +456,10 @@ acpiec_parse_gpe_package(device_t self, 
 		ACPI_FREE(p);
 		return false;
 	}
-	
+
 	if (p->Package.Count != 2) {
-		aprint_error_dev(self, "_GPE package does not contain 2 elements\n");
+		aprint_error_dev(self,
+		"_GPE package does not contain 2 elements\n");
 		ACPI_FREE(p);
 		return false;
 	}
@@ -511,6 +514,7 @@ static ACPI_STATUS
 acpiec_space_setup(ACPI_HANDLE region, uint32_t func, void *arg,
 void **region_arg)
 {
+
 	if (func == ACPI_REGION_DEACTIVATE)
 		*region_arg = NULL;
 	else
@@ -528,9 +532,11 @@ acpiec_lock(device_t dv)
 	mutex_enter(&sc->sc_access_mtx);
 
 	if (sc->sc_need_global_lock) {
-		rv = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT, &sc->sc_global_lock);
+		rv = AcpiAcquireGlobalLock(EC_LOCK_TIMEOUT,
+		&sc->sc_global_lock);
 		if (rv != AE_OK) {
-			aprint_error_dev(dv, "failed to acquire global lock: %s\n",
+			aprint_error_dev(dv,
+			"failed to acquire global lock: %s\n",
 			AcpiFormatException(rv));
 			return;
 		}
@@ -546,7 +552,8 @@ acpiec_unlock(device_t dv)
 	if (sc->sc_need_global_lock) {
 		rv = AcpiReleaseGlobalLock(sc->sc_global_lock);
 		if (rv != AE_OK) {
-			aprint_error_dev(dv, "failed to release global lock: %s\n",
+			aprint_error_dev(dv,
+			"failed to release global lock: %s\n",
 			AcpiFormatException(rv));
 		}
 	}
@@ -587,7 +594,8 @@ acpiec_read(device_t dv, uint8_t addr, u
 	} else if (cv_timedwait(&sc->sc_cv, &sc->sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(&sc->sc_mtx);
 		acpiec_unlock(dv);
-		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
+		aprint_error_dev(dv,
+		"command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
 	}
 
@@ -634,7 +642,8 @@ acpiec_write(device_t dv, uint8_t addr, 
 	} else if (cv_timedwait(&sc->sc_cv, &sc->sc_mtx, EC_CMD_TIMEOUT * hz)) {
 		mutex_exit(&sc->sc_mtx);
 		acpiec_unlock(dv);
-		aprint_error_dev(dv, "command takes over %d sec...\n", EC_CMD_TIMEOUT);
+		aprint_error_dev(dv,
+		"command takes over %d sec...\n", EC_CMD_TIMEOUT);
 		return AE_ERROR;
 	}
 
@@ -648,43 +657,42 @@ static ACPI_STATUS
 acpiec_space_handler(uint32_t func, ACPI_PHYSICAL_ADDRESS paddr,
 uint32_t width, ACPI_INTEGER *value, void *arg, void *region_arg)
 {
-	device_t dv;
+	device_t dv = arg;
 	ACPI_STATUS rv;
-	uint8_t addr, reg;
-	unsigned int i;
+	uint8_t addr;
+	uint8_t *reg;
 
+	if ((func != ACPI_READ) && (func != ACPI_WRITE)) {
+		aprint_error("%s: invalid Address Space function called: %x\n",
+		device_xname(dv), (unsigned int)func);
+		return AE_BAD_PARAMETER;
+	}
 	if (paddr > 0xff || width % 8 != 0 || value == NULL || arg == NULL ||
 	paddr + width / 8 > 0x100)
 		return AE_BAD_PARAMETER;
 
 	addr = paddr;
-	dv = arg;
+	reg = (uint8_t *)value;
 
 	rv = AE_OK;
 
-	switch (func) {
-	case ACPI_READ:
+	if (func == ACPI_READ)
 		*value = 0;
-		for (i = 0; i < width; i += 8, ++addr) {
-			rv = acpiec_read(dv, addr, ®);
-			if (rv != AE_OK)
-break;
-			*value |= (ACPI_INTEGER)reg << i;
-		}
-		break;
-	case ACPI_WRITE:
-		for (i = 0; i < width; i += 8, ++addr) {
-			reg = (*value >>i) & 0xff;
-			rv = acpiec_write(dv, addr, reg);
-			if (rv != AE_OK)
-break;
+
+	do {
+		switch (func) {
+		case ACPI_READ:
+			rv = acpiec_read(dv, addr, reg);
+			break;
+		case AC

CVS commit: src/sys/dev/acpi

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 10:09:35 UTC 2019

Modified Files:
src/sys/dev/acpi: thinkpad_acpi.c

Log Message:
 Fix undefined behavior in thinkpad_mask_init(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/acpi/thinkpad_acpi.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/acpi/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.46 src/sys/dev/acpi/thinkpad_acpi.c:1.47
--- src/sys/dev/acpi/thinkpad_acpi.c:1.46	Sun Apr  3 10:36:00 2016
+++ src/sys/dev/acpi/thinkpad_acpi.c	Mon Aug  5 10:09:35 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.46 2016/04/03 10:36:00 mlelstv Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.47 2019/08/05 10:09:35 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.46 2016/04/03 10:36:00 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.47 2019/08/05 10:09:35 msaitoh Exp $");
 
 #include 
 #include 
@@ -565,7 +565,7 @@ thinkpad_mask_init(thinkpad_softc_t *sc,
 
 	for (i = 0; i < 32; i++) {
 		param[0].Integer.Value = i + 1;
-		param[1].Integer.Value = (((1 << i) & mask) != 0);
+		param[1].Integer.Value = ((__BIT(i) & mask) != 0);
 
 		rv = AcpiEvaluateObject(sc->sc_node->ad_handle, "MHKM",
 		¶ms, NULL);



CVS commit: src/sys/dev/acpi

2019-08-05 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Mon Aug  5 10:09:35 UTC 2019

Modified Files:
src/sys/dev/acpi: thinkpad_acpi.c

Log Message:
 Fix undefined behavior in thinkpad_mask_init(). Found by kUBSan.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/acpi/thinkpad_acpi.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

2019-08-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug  5 07:03:55 UTC 2019

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

Log Message:
Typo in error message


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/usb/if_axen.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

2019-08-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Aug  5 07:03:55 UTC 2019

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

Log Message:
Typo in error message


To generate a diff of this commit:
cvs rdiff -u -r1.53 -r1.54 src/sys/dev/usb/if_axen.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_axen.c
diff -u src/sys/dev/usb/if_axen.c:1.53 src/sys/dev/usb/if_axen.c:1.54
--- src/sys/dev/usb/if_axen.c:1.53	Sun Aug  4 08:59:13 2019
+++ src/sys/dev/usb/if_axen.c	Mon Aug  5 07:03:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axen.c,v 1.53 2019/08/04 08:59:13 mrg Exp $	*/
+/*	$NetBSD: if_axen.c,v 1.54 2019/08/05 07:03:55 skrll Exp $	*/
 /*	$OpenBSD: if_axen.c,v 1.3 2013/10/21 10:10:22 yuo Exp $	*/
 
 /*
@@ -23,7 +23,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.53 2019/08/04 08:59:13 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axen.c,v 1.54 2019/08/05 07:03:55 skrll Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -350,7 +350,7 @@ axen_get_eaddr(struct axen_softc *sc, vo
 	csum = eeprom[6] + eeprom[7] + eeprom[8] + eeprom[9];
 	csum = (csum >> 8) + (csum & 0xff) + eeprom[10];
 	if (csum != 0xff) {
-		printf("eeprom checksum mismatchi(0x%02x)\n", csum);
+		printf("eeprom checksum mismatch(0x%02x)\n", csum);
 		return EINVAL;
 	}