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

2019-09-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 21 00:01:33 UTC 2019

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

Log Message:
Fix off by one in sbc encoder.  Test mode transmission and reception
works again.

XXX pullup -8 and -9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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-09-20 Thread Nathanial Sloss
Module Name:src
Committed By:   nat
Date:   Sat Sep 21 00:01:33 UTC 2019

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

Log Message:
Fix off by one in sbc encoder.  Test mode transmission and reception
works again.

XXX pullup -8 and -9.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 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.9 src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.10
--- src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c:1.9	Mon Aug  5 13:50:58 2019
+++ src/usr.sbin/bta2dpd/bta2dpd/sbc_encode.c	Sat Sep 21 00:01:33 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: sbc_encode.c,v 1.9 2019/08/05 13:50:58 maya Exp $ */
+/* $NetBSD: sbc_encode.c,v 1.10 2019/09/21 00:01:33 nat Exp $ */
 
 /*-
  * Copyright (c) 2015 - 2016 Nathanial Sloss 
@@ -902,7 +902,7 @@ stream(int in, int outfd, uint8_t mode, 
 		totalSize += (size_t)mySize[numpkts];
 		numpkts++;
 
-		if (numpkts > 13)
+		if (numpkts > 12)
 			break;
 	}
 



CVS commit: src/external/cddl/osnet/sbin/zfs

2019-09-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Sep 20 22:47:36 UTC 2019

Modified Files:
src/external/cddl/osnet/sbin/zfs: mount_zfs.8

Log Message:
Use Pa macro for path
new sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sbin/zfs/mount_zfs.8

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



CVS commit: src/external/cddl/osnet/sbin/zfs

2019-09-20 Thread Sevan Janiyan
Module Name:src
Committed By:   sevan
Date:   Fri Sep 20 22:47:36 UTC 2019

Modified Files:
src/external/cddl/osnet/sbin/zfs: mount_zfs.8

Log Message:
Use Pa macro for path
new sentence, new line


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/external/cddl/osnet/sbin/zfs/mount_zfs.8

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

Modified files:

Index: src/external/cddl/osnet/sbin/zfs/mount_zfs.8
diff -u src/external/cddl/osnet/sbin/zfs/mount_zfs.8:1.4 src/external/cddl/osnet/sbin/zfs/mount_zfs.8:1.5
--- src/external/cddl/osnet/sbin/zfs/mount_zfs.8:1.4	Fri Sep 20 22:38:28 2019
+++ src/external/cddl/osnet/sbin/zfs/mount_zfs.8	Fri Sep 20 22:47:36 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mount_zfs.8,v 1.4 2019/09/20 22:38:28 brad Exp $
+.\"	$NetBSD: mount_zfs.8,v 1.5 2019/09/20 22:47:36 sevan Exp $
 .\"
 .\" Copyright (c) 2012, Martin Matuska .
 .\" Copyright (c) 2013-2014, Xin Li .
@@ -46,7 +46,9 @@ where the ZFS property is
 .Xr fstab 5 ,
 .Xr zfs 8
 .Sh HISTORY
-A command to manage legacy ZFS mounts appeared in Solaris as /etc/fs/zfs/mount.  The
+A command to manage legacy ZFS mounts appeared in Solaris as
+.Pa /etc/fs/zfs/mount .
+The
 .Nm
 utility first appeared in
 .Nx 9.0 .



CVS commit: src/external/cddl/osnet/sbin/zfs

2019-09-20 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Sep 20 22:38:28 UTC 2019

Modified Files:
src/external/cddl/osnet/sbin/zfs: mount_zfs.8

Log Message:
Add a copyright to the man page and a bit of history.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sbin/zfs/mount_zfs.8

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

Modified files:

Index: src/external/cddl/osnet/sbin/zfs/mount_zfs.8
diff -u src/external/cddl/osnet/sbin/zfs/mount_zfs.8:1.3 src/external/cddl/osnet/sbin/zfs/mount_zfs.8:1.4
--- src/external/cddl/osnet/sbin/zfs/mount_zfs.8:1.3	Mon Sep 16 04:57:12 2019
+++ src/external/cddl/osnet/sbin/zfs/mount_zfs.8	Fri Sep 20 22:38:28 2019
@@ -1,5 +1,29 @@
-.\"	$NetBSD: mount_zfs.8,v 1.3 2019/09/16 04:57:12 wiz Exp $
+.\"	$NetBSD: mount_zfs.8,v 1.4 2019/09/20 22:38:28 brad Exp $
 .\"
+.\" Copyright (c) 2012, Martin Matuska .
+.\" Copyright (c) 2013-2014, Xin Li .
+.\" All Rights Reserved.
+.\"
+.\" The contents of this file are subject to the terms of the
+.\" Common Development and Distribution License (the "License").
+.\" You may not use this file except in compliance with the License.
+.\"
+.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
+.\" or http://www.opensolaris.org/os/licensing.
+.\" See the License for the specific language governing permissions
+.\" and limitations under the License.
+.\"
+.\" When distributing Covered Code, include this CDDL HEADER in each
+.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE.
+.\" If applicable, add the following below this CDDL HEADER, with the
+.\" fields enclosed by brackets "[]" replaced with your own identifying
+.\" information: Portions Copyright [] [name of copyright owner]
+.\"
+.\" Copyright (c) 2010, Sun Microsystems, Inc. All Rights Reserved.
+.\" Copyright 2011, Nexenta Systems, Inc. All Rights Reserved.
+.\" Copyright (c) 2011, Justin T. Gibbs 
+.\" Copyright (c) 2013 by Delphix. All Rights Reserved.
+.\" Copyright (c) 2012, Glen Barber 
 .\"
 .Dd September 15, 2019
 .Dt MOUNT_ZFS 8
@@ -22,7 +46,7 @@ where the ZFS property is
 .Xr fstab 5 ,
 .Xr zfs 8
 .Sh HISTORY
-The
+A command to manage legacy ZFS mounts appeared in Solaris as /etc/fs/zfs/mount.  The
 .Nm
 utility first appeared in
 .Nx 9.0 .



CVS commit: src/external/cddl/osnet/sbin/zfs

2019-09-20 Thread Brad Spencer
Module Name:src
Committed By:   brad
Date:   Fri Sep 20 22:38:28 UTC 2019

Modified Files:
src/external/cddl/osnet/sbin/zfs: mount_zfs.8

Log Message:
Add a copyright to the man page and a bit of history.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/external/cddl/osnet/sbin/zfs/mount_zfs.8

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



CVS commit: src/sys/arch/powerpc/oea

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:27:29 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/oea/cpu_subr.c

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

Modified files:

Index: src/sys/arch/powerpc/oea/cpu_subr.c
diff -u src/sys/arch/powerpc/oea/cpu_subr.c:1.100 src/sys/arch/powerpc/oea/cpu_subr.c:1.101
--- src/sys/arch/powerpc/oea/cpu_subr.c:1.100	Fri Aug  2 05:08:07 2019
+++ src/sys/arch/powerpc/oea/cpu_subr.c	Fri Sep 20 21:27:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $	*/
 
 /*-
  * Copyright (c) 2001 Matt Thomas.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.100 2019/08/02 05:08:07 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.101 2019/09/20 21:27:29 macallan Exp $");
 
 #include "opt_ppcparam.h"
 #include "opt_ppccache.h"
@@ -584,8 +584,11 @@ cpu_setup(device_t self, struct cpu_info
 			hid0 &= ~HID0_BTIC;
 		/* Select NAP mode. */
 		hid0 &= ~HID0_SLEEP;
-		hid0 |= HID0_NAP | HID0_DPM;
-		powersave = 1;
+		/* XXX my quicksilver hangs if nap is enabled */
+		if (vers != MPC7450) {
+			hid0 |= HID0_NAP | HID0_DPM;
+			powersave = 1;
+		}
 		break;
 #endif
 



CVS commit: src/sys/arch/powerpc/oea

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:27:29 UTC 2019

Modified Files:
src/sys/arch/powerpc/oea: cpu_subr.c

Log Message:
don't enable NAP mode on 7450 CPUs - my Quicksilver has two of those and we
hang hard shortly after boot with NAP enabled, even on UP kernels


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/powerpc/oea/cpu_subr.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/macppc/dev

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:24:34 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
various minor fixes and updates:
- add (very) basic ONYX support. Treat as 16bit codec with software volume
  control. Makes basic audio work on PCIe G5
- correctly detect TAS3001 without 'compatible' property, now this works on
  Quicksilver
- mute line input on TAS3001 - it's unconnected on Quicksilver and causes noise
- make more of an effort to match codecs to i2sbus instances, needed on G5 and
  some other models with software 'modems'


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/snapper.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/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.52 src/sys/arch/macppc/dev/snapper.c:1.53
--- src/sys/arch/macppc/dev/snapper.c:1.52	Sat Jun  8 08:02:37 2019
+++ src/sys/arch/macppc/dev/snapper.c	Fri Sep 20 21:24:34 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.52 2019/06/08 08:02:37 isaki Exp $	*/
+/*	$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.52 2019/06/08 08:02:37 isaki Exp $");
+__KERNEL_RCSID(0, "$NetBSD: snapper.c,v 1.53 2019/09/20 21:24:34 macallan Exp $");
 
 #include 
 #include 
@@ -55,7 +55,7 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 #include 
 #include 
-
+//#define SNAPPER_DEBUG
 #ifdef SNAPPER_DEBUG
 # define DPRINTF printf
 #else
@@ -66,9 +66,12 @@ __KERNEL_RCSID(0, "$NetBSD: snapper.c,v 
 
 struct snapper_softc {
 	device_t sc_dev;
-	int sc_mode;		  // 0 for TAS3004
+	int sc_mode;
+#define SNAPPER_IS_TAS3004	0 // codec is TAS3004
 #define SNAPPER_IS_TAS3001	1 // codec is TAS3001
-#define SNAPPER_SWVOL		2 // software codec
+#define SNAPPER_IS_PCM3052	2 // codec is PCM3052
+#define SNAPPER_IS_CS8416	3 // codec is CS8416
+#define SNAPPER_SWVOL		4 // software codec
 	
 	int sc_node;
 
@@ -475,6 +478,21 @@ static const struct audio_format tumbler
 };
 #define TUMBLER_NFORMATS	__arraycount(tumbler_formats)
 
+/* OF hands us the codec in 16bit mode, run with it for now */
+static const struct audio_format onyx_formats[] = {
+	{
+		.mode		= AUMODE_PLAY | AUMODE_RECORD,
+		.encoding	= AUDIO_ENCODING_SLINEAR_BE,
+		.validbits	= 16,
+		.precision	= 16,
+		.channels	= 2,
+		.channel_mask	= AUFMT_STEREO,
+		.frequency_type	= 3,
+		.frequency	= { 44100, 48000, 96000 },
+	},
+};
+#define ONYX_NFORMATS	__arraycount(onyx_formats)
+
 static bus_size_t amp_mute;
 static bus_size_t headphone_mute;
 static bus_size_t audio_hw_reset;
@@ -492,6 +510,16 @@ static uint8_t headphone_detect_active;
 /* I2S_INT register definitions */
 #define I2S_INT_CLKSTOPPEND 0x0100  /* clock-stop interrupt pending */
 
+/* I2S_WORDSIZE register definitions */
+#define INPUT_STEREO(2 << 24)
+#define INPUT_MONO  (1 << 24)
+#define INPUT_16BIT (0 << 16)
+#define INPUT_24BIT (3 << 16)
+#define OUTPUT_STEREO   (2 << 8)
+#define OUTPUT_MONO (1 << 8)
+#define OUTPUT_16BIT(0 << 0)
+#define OUTPUT_24BIT(3 << 0)
+
 /* FCR(0x3c) bits */
 #define KEYLARGO_FCR1   0x3c
 #define  I2S0CLKEN  0x1000
@@ -639,6 +667,9 @@ snapper_match(device_t parent, struct cf
 	if (strcmp(compat, "AOAK2") == 0)
 		return 1;
 		
+	if (strcmp(compat, "AOAbase") == 0)
+		return 1;
+
 	if (OF_getprop(soundchip, "platform-tas-codec-ref",
 	, sizeof soundcodec) == sizeof soundcodec)
 		return 1;
@@ -664,6 +695,8 @@ snapper_attach(device_t parent, device_t
 	memset(compat, 0, sizeof compat);
 	OF_getprop(OF_child(soundbus), "compatible", compat, sizeof compat);
 
+	sc->sc_mode = SNAPPER_IS_TAS3004;
+
 	if (strcmp(compat, "tumbler") == 0)
 		sc->sc_mode = SNAPPER_IS_TAS3001;
 	sc->sc_swvol_l = 255;
@@ -718,8 +751,8 @@ snapper_attach(device_t parent, device_t
 	oirq = intr[2];
 	iirq = intr[4];
 	/* cirq_type = intr[1] ? IST_LEVEL : IST_EDGE; */
-	oirq_type = intr[3] ? IST_LEVEL : IST_EDGE;
-	iirq_type = intr[5] ? IST_LEVEL : IST_EDGE;
+	oirq_type = (intr[3] & 1) ? IST_LEVEL : IST_EDGE;
+	iirq_type = (intr[5] & 1) ? IST_LEVEL : IST_EDGE;
 
 	/* intr_establish(cirq, cirq_type, IPL_AUDIO, snapper_intr, sc); */
 	intr_establish(oirq, oirq_type, IPL_AUDIO, snapper_intr, sc);
@@ -743,25 +776,79 @@ snapper_defer(device_t dev)
 	device_t dv;
 	deviter_t di;
 	struct deq_softc *deq;
+	char prop[64], next[64], codec[64], *cref;
+	int codec_node, soundbus, sound, ok, deqnode = 0;
 	
 	sc = device_private(dev);
+
+	/* look for platform-*-codec-ref node */
+
+	/*
+	 * XXX
+	 * there can be more than one i2sbus, the one we want just so happens
+	 * to be the first we see
+	 */
+	soundbus = 

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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 21:24:34 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
various minor fixes and updates:
- add (very) basic ONYX support. Treat as 16bit codec with software volume
  control. Makes basic audio work on PCIe G5
- correctly detect TAS3001 without 'compatible' property, now this works on
  Quicksilver
- mute line input on TAS3001 - it's unconnected on Quicksilver and causes noise
- make more of an effort to match codecs to i2sbus instances, needed on G5 and
  some other models with software 'modems'


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/sys/arch/macppc/dev/snapper.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/macppc/dev

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 17:25:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: deq.c

Log Message:
identify TAS3001 from i2c address if there is no 'compatible' property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/dev/deq.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/macppc/dev/deq.c
diff -u src/sys/arch/macppc/dev/deq.c:1.16 src/sys/arch/macppc/dev/deq.c:1.17
--- src/sys/arch/macppc/dev/deq.c:1.16	Tue Jun 26 06:03:57 2018
+++ src/sys/arch/macppc/dev/deq.c	Fri Sep 20 17:25:11 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $	*/
+/*	$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $	*/
 
 /*-
  * Copyright (C) 2005 Michael Lorenz
@@ -32,7 +32,7 @@
  */
  
 #include 
-__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.16 2018/06/26 06:03:57 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: deq.c,v 1.17 2019/09/20 17:25:11 macallan Exp $");
 
 #include 
 #include 
@@ -88,11 +88,14 @@ deq_attach(device_t parent, device_t sel
 	sc->sc_address = ia->ia_addr;
 	sc->sc_i2c = ia->ia_tag;
 	if (OF_getprop(sc->sc_node, "compatible", name, 256) <= 0) {
-		/* deq has no 'compatible' on my iBook G4 */
+		/* deq has no 'compatible' on my iBook G4 or Quicksilver */
 		switch (sc->sc_address) {
 			case 0x35:
 strcpy(name, "tas3004");
 break;
+			case 0x34:
+strcpy(name, "tas3001");
+break;
 			default:
 strcpy(name, "unknown");
 		}



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

2019-09-20 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Fri Sep 20 17:25:11 UTC 2019

Modified Files:
src/sys/arch/macppc/dev: deq.c

Log Message:
identify TAS3001 from i2c address if there is no 'compatible' property


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/arch/macppc/dev/deq.c

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



CVS commit: src/sys/compat

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:25:19 UTC 2019

Modified Files:
src/sys/compat/linux/common: linux_misc.c
src/sys/compat/linux32/common: linux32_unistd.c

Log Message:
Avoid signed integer overflow when convering linux timeval to timespec

Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.40 -r1.41 src/sys/compat/linux32/common/linux32_unistd.c

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



CVS commit: src/sys/compat

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:25:19 UTC 2019

Modified Files:
src/sys/compat/linux/common: linux_misc.c
src/sys/compat/linux32/common: linux32_unistd.c

Log Message:
Avoid signed integer overflow when convering linux timeval to timespec

Linux accepts garbage as timeout and attempts to set it to something
meaningful. Instead of checking for valid ranges of usec, just convert
the type safely, regardless of what is inside it.


To generate a diff of this commit:
cvs rdiff -u -r1.244 -r1.245 src/sys/compat/linux/common/linux_misc.c
cvs rdiff -u -r1.40 -r1.41 src/sys/compat/linux32/common/linux32_unistd.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/compat/linux/common/linux_misc.c
diff -u src/sys/compat/linux/common/linux_misc.c:1.244 src/sys/compat/linux/common/linux_misc.c:1.245
--- src/sys/compat/linux/common/linux_misc.c:1.244	Sat Aug 24 14:21:13 2019
+++ src/sys/compat/linux/common/linux_misc.c	Fri Sep 20 15:25:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_misc.c,v 1.244 2019/08/24 14:21:13 maxv Exp $	*/
+/*	$NetBSD: linux_misc.c,v 1.245 2019/09/20 15:25:19 kamil Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 1999, 2008 The NetBSD Foundation, Inc.
@@ -57,7 +57,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.244 2019/08/24 14:21:13 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_misc.c,v 1.245 2019/09/20 15:25:19 kamil Exp $");
 
 #include 
 #include 
@@ -875,7 +875,7 @@ linux_select1(struct lwp *l, register_t 
 		if ((error = copyin(timeout, , sizeof(ltv
 			return error;
 		uts.tv_sec = ltv.tv_sec;
-		uts.tv_nsec = ltv.tv_usec * 1000;
+		uts.tv_nsec = (long)((unsigned long)ltv.tv_usec * 1000);
 		if (itimespecfix()) {
 			/*
 			 * The timeval was invalid.  Convert it to something

Index: src/sys/compat/linux32/common/linux32_unistd.c
diff -u src/sys/compat/linux32/common/linux32_unistd.c:1.40 src/sys/compat/linux32/common/linux32_unistd.c:1.41
--- src/sys/compat/linux32/common/linux32_unistd.c:1.40	Tue Dec 26 08:30:58 2017
+++ src/sys/compat/linux32/common/linux32_unistd.c	Fri Sep 20 15:25:19 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux32_unistd.c,v 1.40 2017/12/26 08:30:58 kamil Exp $ */
+/*	$NetBSD: linux32_unistd.c,v 1.41 2019/09/20 15:25:19 kamil Exp $ */
 
 /*-
  * Copyright (c) 2006 Emmanuel Dreyfus, all rights reserved.
@@ -33,7 +33,7 @@
 
 #include 
 
-__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.40 2017/12/26 08:30:58 kamil Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux32_unistd.c,v 1.41 2019/09/20 15:25:19 kamil Exp $");
 
 #include 
 #include 
@@ -165,7 +165,7 @@ linux32_select1(struct lwp *l, register_
 			return error;
 
 		uts.tv_sec = utv32.tv_sec;
-		uts.tv_nsec = utv32.tv_usec * 1000;
+		uts.tv_nsec = (long)((unsigned long)utv32.tv_usec * 1000);
 
 		if (itimespecfix()) {
 			/*



CVS commit: src/sys/compat/netbsd32

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:16:41 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_select.c

Log Message:
Validate usec ranges in netbsd32___select50()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/netbsd32/netbsd32_select.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/compat/netbsd32/netbsd32_select.c
diff -u src/sys/compat/netbsd32/netbsd32_select.c:1.19 src/sys/compat/netbsd32/netbsd32_select.c:1.20
--- src/sys/compat/netbsd32/netbsd32_select.c:1.19	Fri Apr 23 15:19:20 2010
+++ src/sys/compat/netbsd32/netbsd32_select.c	Fri Sep 20 15:16:41 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_select.c,v 1.19 2010/04/23 15:19:20 rmind Exp $	*/
+/*	$NetBSD: netbsd32_select.c,v 1.20 2019/09/20 15:16:41 kamil Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Matthew R. Green
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.19 2010/04/23 15:19:20 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_select.c,v 1.20 2019/09/20 15:16:41 kamil Exp $");
 
 #include 
 #include 
@@ -68,6 +68,10 @@ netbsd32___select50(struct lwp *l,
 		error = copyin(SCARG_P32(uap, tv), , sizeof(tv32));
 		if (error != 0)
 			return error;
+
+		if (tv32.tv_usec < 0 || tv32.tv_usec >= 100)
+			return EINVAL;
+
 		ats.tv_sec = tv32.tv_sec;
 		ats.tv_nsec = tv32.tv_usec * 1000;
 		ts = 



CVS commit: src/sys/compat/netbsd32

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:16:41 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_select.c

Log Message:
Validate usec ranges in netbsd32___select50()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/sys/compat/netbsd32/netbsd32_select.c

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



CVS commit: src/sys/compat/netbsd32

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:09:07 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_50.c

Log Message:
Validate usec ranges in compat_50_netbsd32_select()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/netbsd32/netbsd32_compat_50.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/compat/netbsd32/netbsd32_compat_50.c
diff -u src/sys/compat/netbsd32/netbsd32_compat_50.c:1.39 src/sys/compat/netbsd32/netbsd32_compat_50.c:1.40
--- src/sys/compat/netbsd32/netbsd32_compat_50.c:1.39	Thu Jun 27 02:36:27 2019
+++ src/sys/compat/netbsd32/netbsd32_compat_50.c	Fri Sep 20 15:09:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: netbsd32_compat_50.c,v 1.39 2019/06/27 02:36:27 christos Exp $	*/
+/*	$NetBSD: netbsd32_compat_50.c,v 1.40 2019/09/20 15:09:07 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -36,7 +36,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.39 2019/06/27 02:36:27 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: netbsd32_compat_50.c,v 1.40 2019/09/20 15:09:07 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -140,6 +140,10 @@ compat_50_netbsd32_select(struct lwp *l,
 		error = copyin(SCARG_P32(uap, tv), , sizeof(tv32));
 		if (error != 0)
 			return error;
+
+		if (tv32.tv_usec < 0 || tv32.tv_usec >= 100)
+			return EINVAL;
+
 		ats.tv_sec = tv32.tv_sec;
 		ats.tv_nsec = tv32.tv_usec * 1000;
 		ts = 



CVS commit: src/sys/compat/netbsd32

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:09:07 UTC 2019

Modified Files:
src/sys/compat/netbsd32: netbsd32_compat_50.c

Log Message:
Validate usec ranges in compat_50_netbsd32_select()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/compat/netbsd32/netbsd32_compat_50.c

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



CVS commit: src/sys/compat/common

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:05:22 UTC 2019

Modified Files:
src/sys/compat/common: kern_select_50.c

Log Message:
Validate usec ranges in compat_50_sys_select()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/kern_select_50.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/compat/common/kern_select_50.c
diff -u src/sys/compat/common/kern_select_50.c:1.2 src/sys/compat/common/kern_select_50.c:1.3
--- src/sys/compat/common/kern_select_50.c:1.2	Sun Jan 27 02:08:39 2019
+++ src/sys/compat/common/kern_select_50.c	Fri Sep 20 15:05:22 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_select_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $	*/
+/*	$NetBSD: kern_select_50.c,v 1.3 2019/09/20 15:05:22 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_select_50.c,v 1.2 2019/01/27 02:08:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_select_50.c,v 1.3 2019/09/20 15:05:22 kamil Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -114,6 +114,10 @@ compat_50_sys_select(struct lwp *l,
 		error = copyin(SCARG(uap, tv), (void *), sizeof(atv50));
 		if (error)
 			return error;
+
+		if (atv50.tv_usec < 0 || atv50.tv_usec >= 100)
+			return EINVAL;
+
 		ats.tv_sec = atv50.tv_sec;
 		ats.tv_nsec = atv50.tv_usec * 1000;
 		ts = 



CVS commit: src/sys/compat/common

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:05:22 UTC 2019

Modified Files:
src/sys/compat/common: kern_select_50.c

Log Message:
Validate usec ranges in compat_50_sys_select()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/compat/common/kern_select_50.c

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



CVS commit: src/sys/kern

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:00:48 UTC 2019

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

Log Message:
Validate usec ranges in sys___select50()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.48 src/sys/kern/sys_select.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/sys_select.c
diff -u src/sys/kern/sys_select.c:1.47 src/sys/kern/sys_select.c:1.48
--- src/sys/kern/sys_select.c:1.47	Tue Aug 20 01:56:21 2019
+++ src/sys/kern/sys_select.c	Fri Sep 20 15:00:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: sys_select.c,v 1.47 2019/08/20 01:56:21 msaitoh Exp $	*/
+/*	$NetBSD: sys_select.c,v 1.48 2019/09/20 15:00:47 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008, 2009, 2010 The NetBSD Foundation, Inc.
@@ -84,7 +84,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.47 2019/08/20 01:56:21 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.48 2019/09/20 15:00:47 kamil Exp $");
 
 #include 
 #include 
@@ -205,6 +205,10 @@ sys___select50(struct lwp *l, const stru
 		error = copyin(SCARG(uap, tv), (void *), sizeof(atv));
 		if (error)
 			return error;
+
+		if (atv.tv_usec < 0 || atv.tv_usec >= 100)
+			return EINVAL;
+
 		TIMEVAL_TO_TIMESPEC(, );
 		ts = 
 	}



CVS commit: src/sys/kern

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 15:00:48 UTC 2019

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

Log Message:
Validate usec ranges in sys___select50()

Later in the code selcommon() checks for proper timespec, check only
correct usec of timeval before type conversions.


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

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-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 14:53:24 UTC 2019

Modified Files:
src/sys/netinet6: scope6.c

Log Message:
Decorate in6_clearscope() with __noubsan

sys/netinet6/scope6.c:480:6,
member access within misaligned address 0x9457bc441286 for type
'struct in6_addr' which requires 4 byte alignment

This issue is caused by accessing non-__packed struct in __packed.
This is a[always?] false-positive reported by the sanitizer and there is no
clear non-invasive approach to handle this, without changing ABI of long
term existing code.

Reported-by: syzbot+b53a9bcf030288081...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/netinet6/scope6.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/netinet6/scope6.c
diff -u src/sys/netinet6/scope6.c:1.20 src/sys/netinet6/scope6.c:1.21
--- src/sys/netinet6/scope6.c:1.20	Tue May  1 07:21:39 2018
+++ src/sys/netinet6/scope6.c	Fri Sep 20 14:53:24 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: scope6.c,v 1.20 2018/05/01 07:21:39 maxv Exp $	*/
+/*	$NetBSD: scope6.c,v 1.21 2019/09/20 14:53:24 kamil Exp $	*/
 /*	$KAME$	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: scope6.c,v 1.20 2018/05/01 07:21:39 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: scope6.c,v 1.21 2019/09/20 14:53:24 kamil Exp $");
 
 #include 
 #include 
@@ -472,6 +472,7 @@ in6_getscopename(const struct in6_addr *
  * Just clear the embedded scope identifier.  Return 0 if the original address
  * is intact; return non 0 if the address is modified.
  */
+__noubsan
 int
 in6_clearscope(struct in6_addr *in6)
 {



CVS commit: src/sys/netinet6

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 14:53:24 UTC 2019

Modified Files:
src/sys/netinet6: scope6.c

Log Message:
Decorate in6_clearscope() with __noubsan

sys/netinet6/scope6.c:480:6,
member access within misaligned address 0x9457bc441286 for type
'struct in6_addr' which requires 4 byte alignment

This issue is caused by accessing non-__packed struct in __packed.
This is a[always?] false-positive reported by the sanitizer and there is no
clear non-invasive approach to handle this, without changing ABI of long
term existing code.

Reported-by: syzbot+b53a9bcf030288081...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/netinet6/scope6.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/ic

2019-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 20 14:20:45 UTC 2019

Modified Files:
src/sys/dev/ic: isp_netbsd.c isp_netbsd.h

Log Message:
declare printflike functions and fix another printf format.
also change 0x%x -> %#x.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/ic/isp_netbsd.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/isp_netbsd.h

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



CVS commit: src/sys/dev/ic

2019-09-20 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Fri Sep 20 14:20:45 UTC 2019

Modified Files:
src/sys/dev/ic: isp_netbsd.c isp_netbsd.h

Log Message:
declare printflike functions and fix another printf format.
also change 0x%x -> %#x.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/dev/ic/isp_netbsd.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/ic/isp_netbsd.h

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

Modified files:

Index: src/sys/dev/ic/isp_netbsd.c
diff -u src/sys/dev/ic/isp_netbsd.c:1.92 src/sys/dev/ic/isp_netbsd.c:1.93
--- src/sys/dev/ic/isp_netbsd.c:1.92	Fri Sep 20 05:07:35 2019
+++ src/sys/dev/ic/isp_netbsd.c	Fri Sep 20 10:20:45 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.92 2019/09/20 09:07:35 maxv Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.93 2019/09/20 14:20:45 christos Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.92 2019/09/20 09:07:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.93 2019/09/20 14:20:45 christos Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ static const char *roles[4] = {
 "(none)", "Target", "Initiator", "Target/Initiator"
 };
 static const char prom3[] =
-"PortID 0x%06x Departed from Target %u because of %s";
+"PortID %#06x Departed from Target %u because of %s";
 int isp_change_is_bad = 0;	/* "changed" devices are bad */
 int isp_quickboot_time = 15;	/* don't wait more than N secs for loop up */
 static int isp_fabric_hysteresis = 5;
@@ -730,7 +730,7 @@ isprequest(struct scsipi_channel *chan, 
 		sdp->update = 1;
 		ISP_UNLOCK(isp);
 		isp_prt(isp, ISP_LOGDEBUG1,
-		"isprequest: device flags 0x%x for %d.%d.X",
+		"isprequest: device flags %#x for %d.%d.X",
 		dflags, chan->chan_channel, xm->xm_target);
 		break;
 	}
@@ -809,7 +809,7 @@ isp_done(XS_T *xs)
 		}
 		if (xs->error == XS_DRIVER_STUFFUP) {
 			isp_prt(isp, ISP_LOGERR,
-			"BOTCHED cmd for %d.%d.%d cmd 0x%x datalen %ld",
+			"BOTCHED cmd for %d.%d.%d cmd %#x datalen %ld",
 			XS_CHANNEL(xs), XS_TGT(xs), XS_LUN(xs),
 			XS_CDBP(xs)[0], (long) XS_XFRLEN(xs));
 		}
@@ -841,13 +841,13 @@ isp_dog(void *arg)
 
 		if (XS_CMD_DONE_P(xs)) {
 			isp_prt(isp, ISP_LOGDEBUG1,
-			"watchdog found done cmd (handle 0x%x)", handle);
+			"watchdog found done cmd (handle %#x)", handle);
 			goto out;
 		}
 
 		if (XS_CMD_WDOG_P(xs)) {
 			isp_prt(isp, ISP_LOGDEBUG1,
-			"recursive watchdog (handle 0x%x)", handle);
+			"recursive watchdog (handle %#x)", handle);
 			goto out;
 		}
 
@@ -859,12 +859,12 @@ isp_dog(void *arg)
 		}
 		if (XS_CMD_DONE_P(xs)) {
 			isp_prt(isp, ISP_LOGDEBUG1,
-			"watchdog cleanup for handle 0x%x", handle);
+			"watchdog cleanup for handle %#x", handle);
 			XS_CMD_C_WDOG(xs);
 			isp_done(xs);
 		} else if (XS_CMD_GRACE_P(xs)) {
 			isp_prt(isp, ISP_LOGDEBUG1,
-			"watchdog timeout for handle 0x%x", handle);
+			"watchdog timeout for handle %#x", handle);
 			/*
 			 * Make sure the command is *really* dead before we
 			 * release the handle (and DMA resources) for reuse.
@@ -1180,11 +1180,11 @@ isp_async(struct ispsoftc *isp, ispasync
 	int bus, tgt;
 	const char *msg = NULL;
 	static const char prom[] =
-	"PortID 0x%06x handle 0x%x role %s %s\n"
-	"  WWNN 0x%08x%08x WWPN 0x%08x%08x";
+	"PortID %#06x handle %#x role %s %s\n"
+	"  WWNN %#08x%08x WWPN %#08x%08x";
 	static const char prom2[] =
-	"PortID 0x%06x handle 0x%x role %s %s tgt %u\n"
-	"  WWNN 0x%08x%08x WWPN 0x%08x%08x";
+	"PortID %#06x handle %#x role %s %s tgt %u\n"
+	"  WWNN %#08x%08x WWPN %#08x%08x";
 	fcportdb_t *lp;
 	va_list ap;
 
@@ -1495,7 +1495,7 @@ isp_async(struct ispsoftc *isp, ispasync
 			bus = 0;
 		}
 isp_prt(isp, ISP_LOGERR,
-"Internal Firmware Error on bus %d @ RISC Address 0x%x",
+"Internal Firmware Error on bus %d @ RISC Address %#x",
 bus, mbox1);
 		if (IS_FC(isp)) {
 			if (isp->isp_osinfo.blocked == 0) {
@@ -1650,9 +1650,9 @@ isp_mbox_wait_complete(struct ispsoftc *
 		microtime();
 		timersub(, , );
 		isp_prt(isp, ISP_LOGWARN,
-		"%s Mailbox Command (0x%x) Timeout (%uus actual)",
+		"%s Mailbox Command (%#x) Timeout (%juus actual)",
 		isp->isp_osinfo.mbox_sleep_ok? "Interrupting" : "Polled",
-		isp->isp_lastmbxcmd, (elapsed.tv_sec * 100) +
+		isp->isp_lastmbxcmd, (intmax_t)(elapsed.tv_sec * 100) +
 		elapsed.tv_usec);
 		mbp->param[0] = MBOX_TIMEOUT;
 		isp->isp_osinfo.mboxcmd_done = 1;

Index: src/sys/dev/ic/isp_netbsd.h
diff -u src/sys/dev/ic/isp_netbsd.h:1.75 src/sys/dev/ic/isp_netbsd.h:1.76
--- src/sys/dev/ic/isp_netbsd.h:1.75	Fri Aug 28 09:03:36 2015
+++ src/sys/dev/ic/isp_netbsd.h	Fri Sep 20 10:20:45 2019
@@ -1,4 +1,4 @@
-/* 

CVS commit: src/sys/kern

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 14:12:57 UTC 2019

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

Log Message:
Validate usec ranges in settimeofday1()


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/kern/kern_time.c

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



CVS commit: src/sys/kern

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 14:12:57 UTC 2019

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

Log Message:
Validate usec ranges in settimeofday1()


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/kern/kern_time.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_time.c
diff -u src/sys/kern/kern_time.c:1.199 src/sys/kern/kern_time.c:1.200
--- src/sys/kern/kern_time.c:1.199	Wed Aug  7 07:22:12 2019
+++ src/sys/kern/kern_time.c	Fri Sep 20 14:12:57 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_time.c,v 1.199 2019/08/07 07:22:12 mrg Exp $	*/
+/*	$NetBSD: kern_time.c,v 1.200 2019/09/20 14:12:57 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2004, 2005, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.199 2019/08/07 07:22:12 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_time.c,v 1.200 2019/09/20 14:12:57 kamil Exp $");
 
 #include 
 #include 
@@ -482,6 +482,9 @@ settimeofday1(const struct timeval *utv,
 		utv = 
 	}
 
+	if (utv->tv_usec < 0 || utv->tv_usec >= 100)
+		return EINVAL;
+
 	TIMEVAL_TO_TIMESPEC(utv, );
 	return settime1(l->l_proc, , check_kauth);
 }



CVS commit: src/bin/df

2019-09-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Sep 20 13:43:47 UTC 2019

Modified Files:
src/bin/df: df.1

Log Message:
file system police. Fix typo. Fix macro use.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/df/df.1

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

Modified files:

Index: src/bin/df/df.1
diff -u src/bin/df/df.1:1.52 src/bin/df/df.1:1.53
--- src/bin/df/df.1:1.52	Wed Sep 18 23:43:23 2019
+++ src/bin/df/df.1	Fri Sep 20 13:43:47 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: df.1,v 1.52 2019/09/18 23:43:23 christos Exp $
+.\"	$NetBSD: df.1,v 1.53 2019/09/20 13:43:47 wiz Exp $
 .\"
 .\" Copyright (c) 1989, 1990, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -62,7 +62,7 @@ options below).
 Note that the printed count of available blocks takes
 .Va minfree
 into account, and thus will be negative when the number of free blocks
-on the filesystem is less than
+on the file system is less than
 .Va minfree .
 .Pp
 The following options are available:
@@ -162,11 +162,11 @@ option may not be specified with
 .Fl P .
 .It Fl t Ar type
 Is used to indicate the actions should only be taken on
-filesystems of the specified type.
+file systems of the specified type.
 More than one type may be specified in a comma-separated list.
-The list of filesystem types can be prefixed with
+The list of file system types can be prefixed with
 .Dq no
-to specify the filesystem types for which action should
+to specify the file system types for which action should
 .Em not
 be taken.
 If a file system is given on the command line that is not of
@@ -184,8 +184,9 @@ the wedge information.
 This is available to users with root privileges, and usually to
 members of group operator.
 If the wedge information cannot be obtained, for one or more
-filesystems, the
-.Fl W option is silently ignoresd for those filesystems.
+file systems, the
+.Fl W
+option is silently ignored for those file systems.
 .El
 .Sh ENVIRONMENT
 .Bl -tag -width BLOCKSIZE



CVS commit: src/bin/df

2019-09-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Sep 20 13:43:47 UTC 2019

Modified Files:
src/bin/df: df.1

Log Message:
file system police. Fix typo. Fix macro use.


To generate a diff of this commit:
cvs rdiff -u -r1.52 -r1.53 src/bin/df/df.1

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-09-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Sep 20 13:42:24 UTC 2019

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

Log Message:
Fix date, add comma in enumeration.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/mos.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/mos.4
diff -u src/share/man/man4/mos.4:1.1 src/share/man/man4/mos.4:1.2
--- src/share/man/man4/mos.4:1.1	Fri Sep 20 10:34:54 2019
+++ src/share/man/man4/mos.4	Fri Sep 20 13:42:24 2019
@@ -1,4 +1,4 @@
-.\"	$NetBSD: mos.4,v 1.1 2019/09/20 10:34:54 mrg Exp $
+.\"	$NetBSD: mos.4,v 1.2 2019/09/20 13:42:24 wiz Exp $
 .\"
 .\" Copyright (c) 1997, 1998, 1999, 2000-2003
 .\"	Bill Paul . All rights reserved.
@@ -33,7 +33,7 @@
 .\" $FreeBSD: /repoman/r/ncvs/src/share/man/man4/axe.4,v 1.3 2003/05/29 21:28:35 ru Exp $
 .\" $OpenBSD: mos.4,v 1.11 2014/04/08 01:18:19 brad Exp $
 .\"
-.Dd August 24 2019
+.Dd August 24, 2019
 .Dt MOS 4
 .Os
 .Sh NAME
@@ -45,7 +45,7 @@
 The
 .Nm
 driver provides support for USB Ethernet adapters based on the MosChip
-MCS7730, MCS7830 and MCS7832 USB 2.0 chipsets, including the
+MCS7730, MCS7830, and MCS7832 USB 2.0 chipsets, including the
 following:
 .Pp
 .Bl -tag -width Ds -offset indent -compact



CVS commit: src/share/man/man4

2019-09-20 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Fri Sep 20 13:42:24 UTC 2019

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

Log Message:
Fix date, add comma in enumeration.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/share/man/man4/mos.4

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



CVS commit: src/sys

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 13:38:00 UTC 2019

Modified Files:
src/sys/lib/libkern: libkern.h
src/sys/sys: pslist.h

Log Message:
Add ifdefs to eliminate false positives on lgtm, same as coverity.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r1.5 -r1.6 src/sys/sys/pslist.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-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 13:38:00 UTC 2019

Modified Files:
src/sys/lib/libkern: libkern.h
src/sys/sys: pslist.h

Log Message:
Add ifdefs to eliminate false positives on lgtm, same as coverity.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/lib/libkern/libkern.h
cvs rdiff -u -r1.5 -r1.6 src/sys/sys/pslist.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/lib/libkern/libkern.h
diff -u src/sys/lib/libkern/libkern.h:1.131 src/sys/lib/libkern/libkern.h:1.132
--- src/sys/lib/libkern/libkern.h:1.131	Sat Sep  7 09:46:07 2019
+++ src/sys/lib/libkern/libkern.h	Fri Sep 20 13:38:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: libkern.h,v 1.131 2019/09/07 09:46:07 maxv Exp $	*/
+/*	$NetBSD: libkern.h,v 1.132 2019/09/20 13:38:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -336,7 +336,7 @@ tolower(int ch)
  * *fp does not match the type of struct bar::b_foo.
  * We skip the validation for coverity runs to avoid warnings.
  */
-#ifdef __COVERITY__
+#if defined(__COVERITY__) || defined(__LGTM_BOT__)
 #define __validate_container_of(PTR, TYPE, FIELD) 0
 #define __validate_const_container_of(PTR, TYPE, FIELD) 0
 #else

Index: src/sys/sys/pslist.h
diff -u src/sys/sys/pslist.h:1.5 src/sys/sys/pslist.h:1.6
--- src/sys/sys/pslist.h:1.5	Thu Apr 19 21:19:07 2018
+++ src/sys/sys/pslist.h	Fri Sep 20 13:38:00 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pslist.h,v 1.5 2018/04/19 21:19:07 christos Exp $	*/
+/*	$NetBSD: pslist.h,v 1.6 2019/09/20 13:38:00 maxv Exp $	*/
 
 /*-
  * Copyright (c) 2016 The NetBSD Foundation, Inc.
@@ -279,7 +279,7 @@ _pslist_reader_next_container(const stru
  * Type-safe macros for convenience.
  */
 
-#ifdef __COVERITY__
+#if defined(__COVERITY__) || defined(__LGTM_BOT__)
 #define	_PSLIST_VALIDATE_PTRS(P, Q)		0
 #define	_PSLIST_VALIDATE_CONTAINER(P, T, F)	0
 #else



CVS commit: src/sys/kern

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 13:29:31 UTC 2019

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

Log Message:
Validate usec ranges in do_sys_utimes()

sys/kern/vfs_syscalls.c:3939:4, signed integer overflow: 503923632 * 1000 
cannot be represented in type 'int'

Reported-by: syzbot+4cfc86ffd30e8678f...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.534 -r1.535 src/sys/kern/vfs_syscalls.c

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

Modified files:

Index: src/sys/kern/vfs_syscalls.c
diff -u src/sys/kern/vfs_syscalls.c:1.534 src/sys/kern/vfs_syscalls.c:1.535
--- src/sys/kern/vfs_syscalls.c:1.534	Sun Sep 15 20:51:03 2019
+++ src/sys/kern/vfs_syscalls.c	Fri Sep 20 13:29:31 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: vfs_syscalls.c,v 1.534 2019/09/15 20:51:03 christos Exp $	*/
+/*	$NetBSD: vfs_syscalls.c,v 1.535 2019/09/20 13:29:31 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -70,7 +70,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.534 2019/09/15 20:51:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.535 2019/09/20 13:29:31 kamil Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_fileassoc.h"
@@ -3929,14 +3929,22 @@ do_sys_utimes(struct lwp *l, struct vnod
 		if ((tptr[0].tv_usec == UTIME_NOW) || 
 		(tptr[0].tv_usec == UTIME_OMIT))
 			ts[0].tv_nsec = tptr[0].tv_usec;
-		else
+		else {
+			if (tptr[0].tv_usec < 0 || tptr[0].tv_usec >= 100)
+return EINVAL;
+
 			TIMEVAL_TO_TIMESPEC([0], [0]);
+		}
 
 		if ((tptr[1].tv_usec == UTIME_NOW) || 
 		(tptr[1].tv_usec == UTIME_OMIT))
 			ts[1].tv_nsec = tptr[1].tv_usec;
-		else
+		else {
+			if (tptr[1].tv_usec < 0 || tptr[1].tv_usec >= 100)
+return EINVAL;
+
 			TIMEVAL_TO_TIMESPEC([1], [1]);
+		}
 
 		tsptr = [0];	
 	}



CVS commit: src/sys/kern

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 13:29:31 UTC 2019

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

Log Message:
Validate usec ranges in do_sys_utimes()

sys/kern/vfs_syscalls.c:3939:4, signed integer overflow: 503923632 * 1000 
cannot be represented in type 'int'

Reported-by: syzbot+4cfc86ffd30e8678f...@syzkaller.appspotmail.com


To generate a diff of this commit:
cvs rdiff -u -r1.534 -r1.535 src/sys/kern/vfs_syscalls.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-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 12:41:34 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: intel_display.c
intel_runtime_pm.c

Log Message:
Switch CTASSERT() to DRMCTASSERT() in two i915 functions

Fixes build with disabled optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_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-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 12:41:34 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/dist/drm/i915: intel_display.c
intel_runtime_pm.c

Log Message:
Switch CTASSERT() to DRMCTASSERT() in two i915 functions

Fixes build with disabled optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c
cvs rdiff -u -r1.6 -r1.7 \
src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_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/intel_display.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c:1.26 src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c:1.27
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c:1.26	Tue Feb 19 00:30:16 2019
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_display.c	Fri Sep 20 12:41:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_display.c,v 1.26 2019/02/19 00:30:16 christos Exp $	*/
+/*	$NetBSD: intel_display.c,v 1.27 2019/09/20 12:41:33 kamil Exp $	*/
 
 /*
  * Copyright © 2006-2007 Intel Corporation
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_display.c,v 1.26 2019/02/19 00:30:16 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_display.c,v 1.27 2019/09/20 12:41:33 kamil Exp $");
 
 #include 
 #include 
@@ -14969,8 +14969,8 @@ void i915_disable_vga(struct drm_device 
 		aprint_error_dev(dev->pdev->pd_dev,
 		"unable to map VGA registers: %d\n", error);
 	} else {
-		CTASSERT(vgabase <= VGA_SR_INDEX);
-		CTASSERT(vgabase <= VGA_SR_DATA);
+		DRMCTASSERT(vgabase <= VGA_SR_INDEX);
+		DRMCTASSERT(vgabase <= VGA_SR_DATA);
 		bus_space_write_1(iot, ioh, VGA_SR_INDEX - vgabase, SR01);
 		sr1 = bus_space_read_1(iot, ioh, VGA_SR_DATA - vgabase);
 		bus_space_write_1(iot, ioh, VGA_SR_DATA - vgabase,

Index: src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c
diff -u src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c:1.6 src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c:1.7
--- src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c:1.6	Thu Sep 13 08:25:55 2018
+++ src/sys/external/bsd/drm2/dist/drm/i915/intel_runtime_pm.c	Fri Sep 20 12:41:33 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: intel_runtime_pm.c,v 1.6 2018/09/13 08:25:55 mrg Exp $	*/
+/*	$NetBSD: intel_runtime_pm.c,v 1.7 2019/09/20 12:41:33 kamil Exp $	*/
 
 /*
  * Copyright © 2012-2014 Intel Corporation
@@ -29,7 +29,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: intel_runtime_pm.c,v 1.6 2018/09/13 08:25:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intel_runtime_pm.c,v 1.7 2019/09/20 12:41:33 kamil Exp $");
 
 #include 
 #include 
@@ -212,7 +212,7 @@ touch_vga_msr(struct drm_device *dev)
 		device_printf(dev->pdev->pd_dev,
 		"unable to map VGA registers: %d\n", error);
 	} else {
-		CTASSERT(vgabase <= VGA_MSR_READ);
+		DRMCTASSERT(vgabase <= VGA_MSR_READ);
 		msr = bus_space_read_1(iot, ioh, VGA_MSR_READ - vgabase);
 		bus_space_write_1(iot, ioh, VGA_MSR_READ - vgabase, msr);
 		bus_space_unmap(iot, ioh, 0x10);
@@ -2211,4 +2211,3 @@ void intel_runtime_pm_enable(struct drm_
 
 	pm_runtime_put_autosuspend(device);
 }
-



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

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 12:40:23 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/asm: bug.h

Log Message:
Define DRMCTASSERT() for Compile-Time DRMKMS asserts

Switch CTASSERT() to DRMCTASSERT() in BUILD_BUG_ON().

This fixes build issues with disabled compieler optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/asm/bug.h

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



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

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 12:40:23 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/asm: bug.h

Log Message:
Define DRMCTASSERT() for Compile-Time DRMKMS asserts

Switch CTASSERT() to DRMCTASSERT() in BUILD_BUG_ON().

This fixes build issues with disabled compieler optimization.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/external/bsd/drm2/include/asm/bug.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.5 src/sys/external/bsd/drm2/include/asm/bug.h:1.6
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.5	Fri Sep 20 10:54:07 2019
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Fri Sep 20 12:40:23 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.5 2019/09/20 10:54:07 kamil Exp $	*/
+/*	$NetBSD: bug.h,v 1.6 2019/09/20 12:40:23 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -35,19 +35,20 @@
 #include 
 #include 
 
-#define	BUG()			panic("%s:%d: BUG!", __FILE__, __LINE__)
-#define	BUG_ON(CONDITION)	KASSERT(!(CONDITION))
-
-#define	BUILD_BUG()		do {} while (0)
-#define	BUILD_BUG_ON(CONDITION)	CTASSERT(!(CONDITION))
 /*
  * static_assert is violated with runtime-only compiler semantics in a few
  * places. Instead of breaking the build, stop asserting these corner cases.
  */
-#define	BUILD_BUG_ON_MSG(CONDITION,MSG)	\
-	CTASSERT((__builtin_choose_expr(\
-		__builtin_constant_p(CONDITION), !(CONDITION), 1)))
 
+#define DRMCTASSERT(x)	CTASSERT((__builtin_choose_expr(		\
+			__builtin_constant_p(x), (x), 1)))
+
+#define	BUG()			panic("%s:%d: BUG!", __FILE__, __LINE__)
+#define	BUG_ON(CONDITION)	KASSERT(!(CONDITION))
+
+#define	BUILD_BUG()		do {} while (0)
+#define	BUILD_BUG_ON(CONDITION)	DRMCTASSERT(!(CONDITION))
+#define	BUILD_BUG_ON_MSG(CONDITION,MSG)	DRMCTASSERT(!(CONDITION))
 
 /* XXX Rate limit?  */
 #define WARN(CONDITION, FMT, ...)	\



CVS commit: src/sys/dev/ic

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 11:29:47 UTC 2019

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

Log Message:
Don't use the same iterator in a nested loop. (How could this work?)

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/an.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/ic

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 11:29:47 UTC 2019

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

Log Message:
Don't use the same iterator in a nested loop. (How could this work?)

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/dev/ic/an.c

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

Modified files:

Index: src/sys/dev/ic/an.c
diff -u src/sys/dev/ic/an.c:1.70 src/sys/dev/ic/an.c:1.71
--- src/sys/dev/ic/an.c:1.70	Tue Feb  5 06:17:02 2019
+++ src/sys/dev/ic/an.c	Fri Sep 20 11:29:47 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: an.c,v 1.70 2019/02/05 06:17:02 msaitoh Exp $	*/
+/*	$NetBSD: an.c,v 1.71 2019/09/20 11:29:47 maxv Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999
  *	Bill Paul .  All rights reserved.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.70 2019/02/05 06:17:02 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: an.c,v 1.71 2019/09/20 11:29:47 maxv Exp $");
 
 
 #include 
@@ -1240,8 +1240,9 @@ an_set_nwkey_eap(struct an_softc *sc, st
 			 */
 			memset(unibuf, 0, sizeof(unibuf));
 			/* XXX: convert password to unicode */
-			for (i = 0; i < len; i++)
-unibuf[i] = key->an_key[i];
+			int j;
+			for (j = 0; j < len; j++)
+unibuf[j] = key->an_key[j];
 			/* set PasswordHash */
 			MD4Init();
 			MD4Update(, (u_int8_t *)unibuf, len * 2);



CVS commit: src/sys/uvm

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 11:09:43 UTC 2019

Modified Files:
src/sys/uvm: uvm_page.c uvm_physseg.c

Log Message:
Fix programming mistake: 'paddrp' is a pointer given as argument, setting
it to NULL in the called function does not set it to NULL in the caller.

Actually, the callers of these functions do not do anything with the
special error handling, so drop the unused checks and the NULL assignments
altogether.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/uvm_physseg.c

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



CVS commit: src/sys/uvm

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 11:09:43 UTC 2019

Modified Files:
src/sys/uvm: uvm_page.c uvm_physseg.c

Log Message:
Fix programming mistake: 'paddrp' is a pointer given as argument, setting
it to NULL in the called function does not set it to NULL in the caller.

Actually, the callers of these functions do not do anything with the
special error handling, so drop the unused checks and the NULL assignments
altogether.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.199 -r1.200 src/sys/uvm/uvm_page.c
cvs rdiff -u -r1.9 -r1.10 src/sys/uvm/uvm_physseg.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_page.c
diff -u src/sys/uvm/uvm_page.c:1.199 src/sys/uvm/uvm_page.c:1.200
--- src/sys/uvm/uvm_page.c:1.199	Thu Mar 14 19:10:04 2019
+++ src/sys/uvm/uvm_page.c	Fri Sep 20 11:09:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page.c,v 1.199 2019/03/14 19:10:04 kre Exp $	*/
+/*	$NetBSD: uvm_page.c,v 1.200 2019/09/20 11:09:43 maxv Exp $	*/
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.199 2019/03/14 19:10:04 kre Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uvm_page.c,v 1.200 2019/09/20 11:09:43 maxv Exp $");
 
 #include "opt_ddb.h"
 #include "opt_uvm.h"
@@ -629,10 +629,7 @@ uvm_page_physget_freelist(paddr_t *paddr
 			panic("uvm_page_physget: called _after_ bootstrap");
 
 		/* Try to match at front or back on unused segment */
-		if (uvm_page_physunload(lcv, freelist, paddrp) == false) {
-			if (paddrp == NULL) /* freelist fail, try next */
-continue;
-		} else
+		if (uvm_page_physunload(lcv, freelist, paddrp))
 			return true;
 	}
 
@@ -644,10 +641,7 @@ uvm_page_physget_freelist(paddr_t *paddr
 #endif
 	{
 		/* Try the front regardless. */
-		if (uvm_page_physunload_force(lcv, freelist, paddrp) == false) {
-			if (paddrp == NULL) /* freelist fail, try next */
-continue;
-		} else
+		if (uvm_page_physunload_force(lcv, freelist, paddrp))
 			return true;
 	}
 	return false;

Index: src/sys/uvm/uvm_physseg.c
diff -u src/sys/uvm/uvm_physseg.c:1.9 src/sys/uvm/uvm_physseg.c:1.10
--- src/sys/uvm/uvm_physseg.c:1.9	Sun Jan 21 17:58:43 2018
+++ src/sys/uvm/uvm_physseg.c	Fri Sep 20 11:09:43 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: uvm_physseg.c,v 1.9 2018/01/21 17:58:43 christos Exp $ */
+/* $NetBSD: uvm_physseg.c,v 1.10 2019/09/20 11:09:43 maxv Exp $ */
 
 /*
  * Copyright (c) 1997 Charles D. Cranor and Washington University.
@@ -471,7 +471,6 @@ uvm_page_physunload(uvm_physseg_t upm, i
 	seg = HANDLE_TO_PHYSSEG_NODE(upm);
 
 	if (seg->free_list != freelist) {
-		paddrp = NULL;
 		return false;
 	}
 
@@ -516,7 +515,6 @@ uvm_page_physunload_force(uvm_physseg_t 
 		panic("%s: unload attempted after uvm_page_init()\n", __func__);
 	/* any room in this bank? */
 	if (seg->avail_start >= seg->avail_end) {
-		paddrp = NULL;
 		return false; /* nope */
 	}
 
@@ -662,7 +660,6 @@ uvm_page_physunload(uvm_physseg_t psi, i
 	seg = VM_PHYSMEM_PTR(psi);
 
 	if (seg->free_list != freelist) {
-		paddrp = NULL;
 		return false;
 	}
 
@@ -717,7 +714,6 @@ uvm_page_physunload_force(uvm_physseg_t 
 
 	/* any room in this bank? */
 	if (seg->avail_start >= seg->avail_end) {
-		paddrp = NULL;
 		return false; /* nope */
 	}
 



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

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 10:54:07 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/asm: bug.h

Log Message:
Adapt DRMKMS BUILD_BUG_ON_MSG() to static_assert semantics

static_assert is violated with runtime-only compiler semantics in a few
places. Instead of breaking the build, stop asserting these corner cases.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/asm/bug.h

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

Modified files:

Index: src/sys/external/bsd/drm2/include/asm/bug.h
diff -u src/sys/external/bsd/drm2/include/asm/bug.h:1.4 src/sys/external/bsd/drm2/include/asm/bug.h:1.5
--- src/sys/external/bsd/drm2/include/asm/bug.h:1.4	Mon Aug 27 06:19:16 2018
+++ src/sys/external/bsd/drm2/include/asm/bug.h	Fri Sep 20 10:54:07 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: bug.h,v 1.4 2018/08/27 06:19:16 riastradh Exp $	*/
+/*	$NetBSD: bug.h,v 1.5 2019/09/20 10:54:07 kamil Exp $	*/
 
 /*-
  * Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -40,7 +40,13 @@
 
 #define	BUILD_BUG()		do {} while (0)
 #define	BUILD_BUG_ON(CONDITION)	CTASSERT(!(CONDITION))
-#define	BUILD_BUG_ON_MSG(CONDITION,MSG)	CTASSERT(!(CONDITION))
+/*
+ * static_assert is violated with runtime-only compiler semantics in a few
+ * places. Instead of breaking the build, stop asserting these corner cases.
+ */
+#define	BUILD_BUG_ON_MSG(CONDITION,MSG)	\
+	CTASSERT((__builtin_choose_expr(\
+		__builtin_constant_p(CONDITION), !(CONDITION), 1)))
 
 
 /* XXX Rate limit?  */



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

2019-09-20 Thread Kamil Rytarowski
Module Name:src
Committed By:   kamil
Date:   Fri Sep 20 10:54:07 UTC 2019

Modified Files:
src/sys/external/bsd/drm2/include/asm: bug.h

Log Message:
Adapt DRMKMS BUILD_BUG_ON_MSG() to static_assert semantics

static_assert is violated with runtime-only compiler semantics in a few
places. Instead of breaking the build, stop asserting these corner cases.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/external/bsd/drm2/include/asm/bug.h

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



CVS commit: src

2019-09-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Sep 20 10:34:54 UTC 2019

Modified Files:
src/distrib/sets/lists/man: mi
src/doc: CHANGES
src/share/man/man4: Makefile usbnet.4
src/sys/dev/usb: files.usb usbdevices.config
Added Files:
src/share/man/man4: mos.4
src/sys/dev/usb: if_mos.c if_mosreg.h

Log Message:
add mos(4) driver for Moschip MCS7730/MCS7830/MCS7832 usb ethernet.
ported from openbsd.  usbnet version loses about 40% of code.


To generate a diff of this commit:
cvs rdiff -u -r1.1653 -r1.1654 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.2583 -r1.2584 src/doc/CHANGES
cvs rdiff -u -r1.681 -r1.682 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/mos.4
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/usbnet.4
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/files.usb
cvs rdiff -u -r0 -r1.1 src/sys/dev/usb/if_mos.c src/sys/dev/usb/if_mosreg.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/usbdevices.config

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

Modified files:

Index: src/distrib/sets/lists/man/mi
diff -u src/distrib/sets/lists/man/mi:1.1653 src/distrib/sets/lists/man/mi:1.1654
--- src/distrib/sets/lists/man/mi:1.1653	Mon Sep 16 08:31:05 2019
+++ src/distrib/sets/lists/man/mi	Fri Sep 20 10:34:54 2019
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.1653 2019/09/16 08:31:05 mlelstv Exp $
+# $NetBSD: mi,v 1.1654 2019/09/20 10:34:54 mrg Exp $
 #
 # Note: don't delete entries from here - mark them as "obsolete" instead.
 #
@@ -1454,6 +1454,7 @@
 ./usr/share/man/cat4/mlx.0			man-sys-catman		.cat
 ./usr/share/man/cat4/mly.0			man-sys-catman		.cat
 ./usr/share/man/cat4/module.0			man-obsolete		obsolete
+./usr/share/man/cat4/mos.0			man-sys-catman		.cat
 ./usr/share/man/cat4/mpii.0			man-sys-catman		.cat
 ./usr/share/man/cat4/mpl115a.0			man-sys-catman		.cat
 ./usr/share/man/cat4/mpls.0			man-sys-catman		.cat
@@ -4586,6 +4587,7 @@
 ./usr/share/man/html4/mlx.html			man-sys-htmlman		html
 ./usr/share/man/html4/mly.html			man-sys-htmlman		html
 ./usr/share/man/html4/module.html		man-obsolete		obsolete
+./usr/share/man/html4/mos.html			man-sys-htmlman		html
 ./usr/share/man/html4/mpii.html			man-sys-htmlman		html
 ./usr/share/man/html4/mpl115a.html		man-sys-htmlman		html
 ./usr/share/man/html4/mpls.html			man-sys-htmlman		html
@@ -7568,6 +7570,7 @@
 ./usr/share/man/man4/mlx.4			man-sys-man		.man
 ./usr/share/man/man4/mly.4			man-sys-man		.man
 ./usr/share/man/man4/module.4			man-obsolete		obsolete
+./usr/share/man/man4/mos.4			man-sys-man		.man
 ./usr/share/man/man4/mpii.4			man-sys-man		.man
 ./usr/share/man/man4/mpl115a.4			man-sys-man		.man
 ./usr/share/man/man4/mpls.4			man-sys-man		.man

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.2583 src/doc/CHANGES:1.2584
--- src/doc/CHANGES:1.2583	Sun Sep 15 15:19:49 2019
+++ src/doc/CHANGES	Fri Sep 20 10:34:54 2019
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2583 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.2584 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -43,3 +43,5 @@ Changes from NetBSD 9.0 to NetBSD 10.0:
 	dhcpcd(8): Import dhcpcd-8.0.6 [roy 20190913]
 	kernel: Add vHCI, a driver that allows to send and receive USB
 		packets from userland. [maxv 20190914]
+	mos(4): Ported driver for MosChip MCS7730/7830/7832 USB ethernet.
+		[mrg 20190814]

Index: src/share/man/man4/Makefile
diff -u src/share/man/man4/Makefile:1.681 src/share/man/man4/Makefile:1.682
--- src/share/man/man4/Makefile:1.681	Fri Aug 30 08:54:58 2019
+++ src/share/man/man4/Makefile	Fri Sep 20 10:34:54 2019
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.681 2019/08/30 08:54:58 mrg Exp $
+#	$NetBSD: Makefile,v 1.682 2019/09/20 10:34:54 mrg Exp $
 #	@(#)Makefile	8.1 (Berkeley) 6/18/93
 
 MAN=	aac.4 ac97.4 acardide.4 aceride.4 acphy.4 \
@@ -64,7 +64,8 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	tap.4 tc.4 tcds.4 tcp.4 tcu.4 tdvfb.4 tea5767radio.4 termios.4 tfb.4 \
 	thinkpad.4 ti.4 tl.4 tlp.4 tlphy.4 tpm.4 tprof.4 tr.4 tra.4 \
 	trm.4 tsllux.4 tty.4 tun.4 tqphy.4 twa.4 twe.4 txp.4 \
-	uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 umb.4 unix.4 userconf.4 \
+	uark.4 ubsec.4 udp.4 uep.4 ug.4 uha.4 uk.4 ukphy.4 umb.4 \
+	unix.4 userconf.4 \
 	vald.4 valz.4 veriexec.4 vga.4 vge.4 viaide.4 video.4 vioif.4 viomb.4 \
 	viornd.4 vioscsi.4 virt.4 \
 	virtio.4 vlan.4 vmmon.4 vmnet.4 vnd.4 voodoofb.4 vr.4 vte.4 \
@@ -75,7 +76,8 @@ MAN=	aac.4 ac97.4 acardide.4 aceride.4 a
 	zero.4 zstty.4 zyd.4
 
 # USB devices
-MAN+=	atu.4 aubtfwl.4 aue.4 axe.4 axen.4 cdce.4 cue.4 ehci.4 kue.4 mue.4 \
+MAN+=	atu.4 aubtfwl.4 aue.4 axe.4 axen.4 cdce.4 cue.4 ehci.4 kue.4 \
+	mos.4 mue.4 \
 	ohci.4 \
 	slhci.4 stuirda.4 u3g.4 ualea.4 uatp.4 uaudio.4 uberry.4 ubsa.4 ubt.4 \
 	uchcom.4 \

Index: src/share/man/man4/usbnet.4
diff -u src/share/man/man4/usbnet.4:1.3 src/share/man/man4/usbnet.4:1.4
--- 

CVS commit: src

2019-09-20 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Fri Sep 20 10:34:54 UTC 2019

Modified Files:
src/distrib/sets/lists/man: mi
src/doc: CHANGES
src/share/man/man4: Makefile usbnet.4
src/sys/dev/usb: files.usb usbdevices.config
Added Files:
src/share/man/man4: mos.4
src/sys/dev/usb: if_mos.c if_mosreg.h

Log Message:
add mos(4) driver for Moschip MCS7730/MCS7830/MCS7832 usb ethernet.
ported from openbsd.  usbnet version loses about 40% of code.


To generate a diff of this commit:
cvs rdiff -u -r1.1653 -r1.1654 src/distrib/sets/lists/man/mi
cvs rdiff -u -r1.2583 -r1.2584 src/doc/CHANGES
cvs rdiff -u -r1.681 -r1.682 src/share/man/man4/Makefile
cvs rdiff -u -r0 -r1.1 src/share/man/man4/mos.4
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/usbnet.4
cvs rdiff -u -r1.167 -r1.168 src/sys/dev/usb/files.usb
cvs rdiff -u -r0 -r1.1 src/sys/dev/usb/if_mos.c src/sys/dev/usb/if_mosreg.h
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/usbdevices.config

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



CVS commit: src/sys/dev/pci

2019-09-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 20 10:04:45 UTC 2019

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

Log Message:
 Print some DPC register values not with %04x but with %08x because those
are 32bit.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/dev/pci/pci_subr.c

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



CVS commit: src/sys/dev/pci

2019-09-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 20 10:04:45 UTC 2019

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

Log Message:
 Print some DPC register values not with %04x but with %08x because those
are 32bit.


To generate a diff of this commit:
cvs rdiff -u -r1.216 -r1.217 src/sys/dev/pci/pci_subr.c

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

Modified files:

Index: src/sys/dev/pci/pci_subr.c
diff -u src/sys/dev/pci/pci_subr.c:1.216 src/sys/dev/pci/pci_subr.c:1.217
--- src/sys/dev/pci/pci_subr.c:1.216	Wed Aug 21 02:10:20 2019
+++ src/sys/dev/pci/pci_subr.c	Fri Sep 20 10:04:45 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_subr.c,v 1.216 2019/08/21 02:10:20 msaitoh Exp $	*/
+/*	$NetBSD: pci_subr.c,v 1.217 2019/09/20 10:04:45 msaitoh Exp $	*/
 
 /*
  * Copyright (c) 1997 Zubin D. Dittia.  All rights reserved.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.216 2019/08/21 02:10:20 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_subr.c,v 1.217 2019/09/20 10:04:45 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_pci.h"
@@ -3990,23 +3990,23 @@ pci_conf_print_dpc_cap(const pcireg_t *r
 	 */
 
 	reg = regs[o2i(extcapoff + PCI_DPC_RPPIO_STAT)];
-	printf("RP PIO Status Register: 0x%04x\n", reg);
+	printf("RP PIO Status Register: 0x%08x\n", reg);
 	pci_conf_print_dpc_pio(reg);
 
 	reg = regs[o2i(extcapoff + PCI_DPC_RPPIO_MASK)];
-	printf("RP PIO Mask Register: 0x%04x\n", reg);
+	printf("RP PIO Mask Register: 0x%08x\n", reg);
 	pci_conf_print_dpc_pio(reg);
 
 	reg = regs[o2i(extcapoff + PCI_DPC_RPPIO_SEVE)];
-	printf("RP PIO Severity Register: 0x%04x\n", reg);
+	printf("RP PIO Severity Register: 0x%08x\n", reg);
 	pci_conf_print_dpc_pio(reg);
 
 	reg = regs[o2i(extcapoff + PCI_DPC_RPPIO_SYSERR)];
-	printf("RP PIO SysError Register: 0x%04x\n", reg);
+	printf("RP PIO SysError Register: 0x%08x\n", reg);
 	pci_conf_print_dpc_pio(reg);
 
 	reg = regs[o2i(extcapoff + PCI_DPC_RPPIO_EXCPT)];
-	printf("RP PIO Exception Register: 0x%04x\n", reg);
+	printf("RP PIO Exception Register: 0x%08x\n", reg);
 	pci_conf_print_dpc_pio(reg);
 
 	printf("RP PIO Header Log Register: start from 0x%03x\n",



CVS commit: src/sys/dev/pci/ixgbe

2019-09-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 20 09:28:37 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_type.h ixgbe_vf.c ixv.c

Log Message:
- Make ixv_set_multi() work correctly (especially for PROMISC) when the
  function is called from if_init().
- If a multicast entry has range, use ALLMULTI like others.
- Remove ixv_set_promisc() and use ixv_set_multi(). And then, rename
  *_set_multi() to *_set_rxfilter(). Same as ixgbe.c.
- The promisc mode can't be enabled if the PF is not in promisc mode.
  Identify that state and report it as "the PF may not in promisc mode"
  (though it might not be perfect).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/ixgbe/ixv.c

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



CVS commit: src/sys/dev/pci/ixgbe

2019-09-20 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Fri Sep 20 09:28:37 UTC 2019

Modified Files:
src/sys/dev/pci/ixgbe: ixgbe_type.h ixgbe_vf.c ixv.c

Log Message:
- Make ixv_set_multi() work correctly (especially for PROMISC) when the
  function is called from if_init().
- If a multicast entry has range, use ALLMULTI like others.
- Remove ixv_set_promisc() and use ixv_set_multi(). And then, rename
  *_set_multi() to *_set_rxfilter(). Same as ixgbe.c.
- The promisc mode can't be enabled if the PF is not in promisc mode.
  Identify that state and report it as "the PF may not in promisc mode"
  (though it might not be perfect).


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/dev/pci/ixgbe/ixgbe_type.h
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/pci/ixgbe/ixgbe_vf.c
cvs rdiff -u -r1.137 -r1.138 src/sys/dev/pci/ixgbe/ixv.c

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

Modified files:

Index: src/sys/dev/pci/ixgbe/ixgbe_type.h
diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.42 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.43
--- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.42	Thu Sep 12 12:25:46 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_type.h	Fri Sep 20 09:28:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_type.h,v 1.42 2019/09/12 12:25:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe_type.h,v 1.43 2019/09/20 09:28:37 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -4312,6 +4312,7 @@ struct ixgbe_hw {
 #define IXGBE_ERR_TOKEN_RETRY			-40
 
 #define IXGBE_ERR_NOT_TRUSTED			-50 /* XXX NetBSD */
+#define IXGBE_ERR_NOT_IN_PROMISC		-51 /* XXX NetBSD */
 
 #define IXGBE_NOT_IMPLEMENTED			0x7FFF
 

Index: src/sys/dev/pci/ixgbe/ixgbe_vf.c
diff -u src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.21 src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.22
--- src/sys/dev/pci/ixgbe/ixgbe_vf.c:1.21	Thu Sep 12 12:25:46 2019
+++ src/sys/dev/pci/ixgbe/ixgbe_vf.c	Fri Sep 20 09:28:37 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: ixgbe_vf.c,v 1.21 2019/09/12 12:25:46 msaitoh Exp $ */
+/* $NetBSD: ixgbe_vf.c,v 1.22 2019/09/20 09:28:37 msaitoh Exp $ */
 
 /**
   SPDX-License-Identifier: BSD-3-Clause
@@ -460,8 +460,17 @@ s32 ixgbevf_update_xcast_mode(struct ixg
 		return err;
 
 	msgbuf[0] &= ~IXGBE_VT_MSGTYPE_CTS;
-	if (msgbuf[0] == (IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK))
-		return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	if (msgbuf[0] ==
+	(IXGBE_VF_UPDATE_XCAST_MODE | IXGBE_VT_MSGTYPE_NACK)) {
+		if (xcast_mode == IXGBEVF_XCAST_MODE_PROMISC) {
+			/*
+			 * If the API version matched and the reply was NACK,
+			 * assume the PF was not in PROMISC mode.
+			 */
+			return IXGBE_ERR_NOT_IN_PROMISC;
+		} else
+			return IXGBE_ERR_FEATURE_NOT_SUPPORTED;
+	}
 	/*
 	 *  On linux's PF driver implementation, the PF replies VF's
 	 * XCAST_MODE_ALLMULTI message not with NACK but with ACK even if the

Index: src/sys/dev/pci/ixgbe/ixv.c
diff -u src/sys/dev/pci/ixgbe/ixv.c:1.137 src/sys/dev/pci/ixgbe/ixv.c:1.138
--- src/sys/dev/pci/ixgbe/ixv.c:1.137	Fri Sep 13 08:09:24 2019
+++ src/sys/dev/pci/ixgbe/ixv.c	Fri Sep 20 09:28:37 2019
@@ -1,4 +1,4 @@
-/*$NetBSD: ixv.c,v 1.137 2019/09/13 08:09:24 msaitoh Exp $*/
+/*$NetBSD: ixv.c,v 1.138 2019/09/20 09:28:37 msaitoh Exp $*/
 
 /**
 
@@ -112,8 +112,7 @@ static s32	ixv_check_link(struct adapter
 
 static void	ixv_enable_intr(struct adapter *);
 static void	ixv_disable_intr(struct adapter *);
-static int	ixv_set_promisc(struct adapter *);
-static void	ixv_set_multi(struct adapter *);
+static int	ixv_set_rxfilter(struct adapter *);
 static void	ixv_update_link_status(struct adapter *);
 static int	ixv_sysctl_debug(SYSCTLFN_PROTO);
 static void	ixv_set_ivar(struct adapter *, u8, u8, s8);
@@ -743,7 +742,7 @@ ixv_init_locked(struct adapter *adapter)
 	ixv_initialize_transmit_units(adapter);
 
 	/* Setup Multicast table */
-	ixv_set_multi(adapter);
+	ixv_set_rxfilter(adapter);
 
 	/*
 	 * Determine the correct mbuf pool
@@ -1076,70 +1075,6 @@ ixv_media_change(struct ifnet *ifp)
 } /* ixv_media_change */
 
 /
- * ixv_set_promisc
- /
-static int
-ixv_set_promisc(struct adapter *adapter)
-{
-	struct ifnet *ifp = adapter->ifp;
-	struct ixgbe_hw *hw = >hw;
-	struct ethercom *ec = >osdep.ec;
-	int error = 0;
-
-	KASSERT(mutex_owned(>core_mtx));
-	if (ifp->if_flags & IFF_PROMISC) {
-		error = hw->mac.ops.update_xcast_mode(hw,
-		IXGBEVF_XCAST_MODE_PROMISC);
-		if (error == IXGBE_ERR_NOT_TRUSTED) {
-			device_printf(adapter->dev,
-			"this interface is not trusted\n");
-			error = EPERM;
-		} else if (error == IXGBE_ERR_FEATURE_NOT_SUPPORTED) {
-			device_printf(adapter->dev,
-			

CVS commit: src/sys/dev/ic

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 09:07:35 UTC 2019

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

Log Message:
Fix argument.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/ic/isp_netbsd.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/ic

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 09:07:35 UTC 2019

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

Log Message:
Fix argument.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/dev/ic/isp_netbsd.c

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

Modified files:

Index: src/sys/dev/ic/isp_netbsd.c
diff -u src/sys/dev/ic/isp_netbsd.c:1.91 src/sys/dev/ic/isp_netbsd.c:1.92
--- src/sys/dev/ic/isp_netbsd.c:1.91	Sun Feb  3 03:19:27 2019
+++ src/sys/dev/ic/isp_netbsd.c	Fri Sep 20 09:07:35 2019
@@ -1,4 +1,4 @@
-/* $NetBSD: isp_netbsd.c,v 1.91 2019/02/03 03:19:27 mrg Exp $ */
+/* $NetBSD: isp_netbsd.c,v 1.92 2019/09/20 09:07:35 maxv Exp $ */
 /*
  * Platform (NetBSD) dependent common attachment code for Qlogic adapters.
  */
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.91 2019/02/03 03:19:27 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: isp_netbsd.c,v 1.92 2019/09/20 09:07:35 maxv Exp $");
 
 #include 
 #include 
@@ -609,7 +609,7 @@ ispcmd(struct ispsoftc *isp, XS_T *xs)
 	}
 	if (isp->isp_osinfo.blocked) {
 		isp_prt(isp, ISP_LOGWARN,
-		"I/O while blocked with retries %d", xs, xs->xs_retries);
+		"I/O while blocked with retries %d", xs->xs_retries);
 		if (xs->xs_retries) {
 			xs->error = XS_REQUEUE;
 			xs->xs_retries--;



CVS commit: src/sys/dev/ic

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 09:00:50 UTC 2019

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

Log Message:
Fix direction of the loop.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/ic/i82557.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/ic

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 09:00:50 UTC 2019

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

Log Message:
Fix direction of the loop.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.154 -r1.155 src/sys/dev/ic/i82557.c

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

Modified files:

Index: src/sys/dev/ic/i82557.c
diff -u src/sys/dev/ic/i82557.c:1.154 src/sys/dev/ic/i82557.c:1.155
--- src/sys/dev/ic/i82557.c:1.154	Tue Jul  9 08:46:58 2019
+++ src/sys/dev/ic/i82557.c	Fri Sep 20 09:00:50 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82557.c,v 1.154 2019/07/09 08:46:58 msaitoh Exp $	*/
+/*	$NetBSD: i82557.c,v 1.155 2019/09/20 09:00:50 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 1999, 2001, 2002 The NetBSD Foundation, Inc.
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.154 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i82557.c,v 1.155 2019/09/20 09:00:50 maxv Exp $");
 
 #include 
 #include 
@@ -1892,7 +1892,7 @@ fxp_init(struct ifnet *ifp)
 	CSR_WRITE_4(sc, FXP_CSR_SCB_GENERAL, sc->sc_cddma + FXP_CDIASOFF);
 	fxp_scb_cmd(sc, FXP_SCB_COMMAND_CU_START);
 	/* ...and wait for it to complete. */
-	for (i = 1000; i > 0; i++) {
+	for (i = 1000; i > 0; i--) {
 		FXP_CDIASSYNC(sc,
 		BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE);
 		status = le16toh(cb_ias->cb_status);



CVS commit: src/sys/dev/pci

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:58:25 UTC 2019

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

Log Message:
Fix direction of the loop.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/if_age.c

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



CVS commit: src/sys/dev/pci

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:58:25 UTC 2019

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

Log Message:
Fix direction of the loop.

Found by the lgtm bot.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/dev/pci/if_age.c

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

Modified files:

Index: src/sys/dev/pci/if_age.c
diff -u src/sys/dev/pci/if_age.c:1.60 src/sys/dev/pci/if_age.c:1.61
--- src/sys/dev/pci/if_age.c:1.60	Tue Jul  9 08:46:58 2019
+++ src/sys/dev/pci/if_age.c	Fri Sep 20 08:58:25 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_age.c,v 1.60 2019/07/09 08:46:58 msaitoh Exp $ */
+/*	$NetBSD: if_age.c,v 1.61 2019/09/20 08:58:25 maxv Exp $ */
 /*	$OpenBSD: if_age.c,v 1.1 2009/01/16 05:00:34 kevlo Exp $	*/
 
 /*-
@@ -31,7 +31,7 @@
 /* Driver for Attansic Technology Corp. L1 Gigabit Ethernet. */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.60 2019/07/09 08:46:58 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_age.c,v 1.61 2019/09/20 08:58:25 maxv Exp $");
 
 #include "vlan.h"
 
@@ -575,7 +575,7 @@ age_get_macaddr(struct age_softc *sc, ui
 		 */
 		CSR_WRITE_4(sc, AGE_TWSI_CTRL, CSR_READ_4(sc, AGE_TWSI_CTRL) |
 		TWSI_CTRL_SW_LD_START);
-		for (i = 100; i > 0; i++) {
+		for (i = 100; i > 0; i--) {
 			DELAY(1000);
 			reg = CSR_READ_4(sc, AGE_TWSI_CTRL);
 			if ((reg & TWSI_CTRL_SW_LD_START) == 0)



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

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:48:55 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c

Log Message:
Use M_BUFADDR.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/imx/if_enet.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/arm/imx

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:48:55 UTC 2019

Modified Files:
src/sys/arch/arm/imx: if_enet.c

Log Message:
Use M_BUFADDR.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/arm/imx/if_enet.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/if_enet.c
diff -u src/sys/arch/arm/imx/if_enet.c:1.26 src/sys/arch/arm/imx/if_enet.c:1.27
--- src/sys/arch/arm/imx/if_enet.c:1.26	Fri Sep 13 07:55:05 2019
+++ src/sys/arch/arm/imx/if_enet.c	Fri Sep 20 08:48:55 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_enet.c,v 1.26 2019/09/13 07:55:05 msaitoh Exp $	*/
+/*	$NetBSD: if_enet.c,v 1.27 2019/09/20 08:48:55 maxv Exp $	*/
 
 /*
  * Copyright (c) 2014 Ryo Shimizu 
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.26 2019/09/13 07:55:05 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_enet.c,v 1.27 2019/09/20 08:48:55 maxv Exp $");
 
 #include "vlan.h"
 
@@ -1528,14 +1528,7 @@ enet_encap_mbufalign(struct mbuf **mp)
 		 * m_dat[] (aligned) to en-
 		 * large trailingspace
 		 */
-		if (mt->m_flags & M_EXT) {
-			ap = mt->m_ext.ext_buf;
-		} else if (mt->m_flags &
-		M_PKTHDR) {
-			ap = mt->m_pktdat;
-		} else {
-			ap = mt->m_dat;
-		}
+		ap = M_BUFADDR(mt);
 		ap = ALIGN_PTR(ap, ALIGNBYTE);
 		memcpy(ap, mt->m_data,
 		mt->m_len);



CVS commit: src/sys/net

2019-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:45:30 UTC 2019

Modified Files:
src/sys/net: if_ppp.c ppp_tty.c

Log Message:
dedup


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/net/if_ppp.c
cvs rdiff -u -r1.65 -r1.66 src/sys/net/ppp_tty.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-09-20 Thread Maxime Villard
Module Name:src
Committed By:   maxv
Date:   Fri Sep 20 08:45:30 UTC 2019

Modified Files:
src/sys/net: if_ppp.c ppp_tty.c

Log Message:
dedup


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/sys/net/if_ppp.c
cvs rdiff -u -r1.65 -r1.66 src/sys/net/ppp_tty.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_ppp.c
diff -u src/sys/net/if_ppp.c:1.165 src/sys/net/if_ppp.c:1.166
--- src/sys/net/if_ppp.c:1.165	Tue Jun 25 12:30:50 2019
+++ src/sys/net/if_ppp.c	Fri Sep 20 08:45:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.165 2019/06/25 12:30:50 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ppp.c,v 1.166 2019/09/20 08:45:29 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -181,19 +181,6 @@ static void	pppintr(void *);
 extern struct linesw ppp_disc;
 
 /*
- * Some useful mbuf macros not in mbuf.h.
- */
-#define M_IS_CLUSTER(m)	((m)->m_flags & M_EXT)
-
-#define M_DATASTART(m)			\
-	(M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf :\
-	(m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
-
-#define M_DATASIZE(m)			\
-	(M_IS_CLUSTER(m) ? (m)->m_ext.ext_size :			\
-	(m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
-
-/*
  * We define two link layer specific mbuf flags, to mark high-priority
  * packets for output, and received packets following lost/corrupted
  * packets.
@@ -1624,7 +1611,7 @@ ppp_inproc(struct ppp_softc *sc, struct 
 	 * If the packet will fit in a header mbuf, don't waste a
 	 * whole cluster on it.
 	 */
-	if (ilen <= MHLEN && M_IS_CLUSTER(m)) {
+	if (ilen <= MHLEN && (m->m_flags & M_EXT)) {
 		MGETHDR(mp, M_DONTWAIT, MT_DATA);
 		if (mp != NULL) {
 			m_copydata(m, 0, ilen, mtod(mp, void *));

Index: src/sys/net/ppp_tty.c
diff -u src/sys/net/ppp_tty.c:1.65 src/sys/net/ppp_tty.c:1.66
--- src/sys/net/ppp_tty.c:1.65	Thu Jan 24 09:31:09 2019
+++ src/sys/net/ppp_tty.c	Fri Sep 20 08:45:29 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $	*/
+/*	$NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $	*/
 /*	Id: ppp_tty.c,v 1.3 1996/07/01 01:04:11 paulus Exp 	*/
 
 /*
@@ -93,7 +93,7 @@
 /* from NetBSD: if_ppp.c,v 1.15.2.2 1994/07/28 05:17:58 cgd Exp */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.65 2019/01/24 09:31:09 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ppp_tty.c,v 1.66 2019/09/20 08:45:29 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "ppp.h"
@@ -166,19 +166,6 @@ static void	ppplogchar(struct ppp_softc 
 static void	pppdumpframe(struct ppp_softc *sc, struct mbuf* m, int xmit);
 
 /*
- * Some useful mbuf macros not in mbuf.h.
- */
-#define M_IS_CLUSTER(m)	((m)->m_flags & M_EXT)
-
-#define M_DATASTART(m)	\
-	(M_IS_CLUSTER(m) ? (m)->m_ext.ext_buf : \
-	(m)->m_flags & M_PKTHDR ? (m)->m_pktdat : (m)->m_dat)
-
-#define M_DATASIZE(m)	\
-	(M_IS_CLUSTER(m) ? (m)->m_ext.ext_size : \
-	(m)->m_flags & M_PKTHDR ? MHLEN: MLEN)
-
-/*
  * Does c need to be escaped?
  */
 #define ESCAPE_P(c)	(sc->sc_asyncmap[(c) >> 5] & (1 << ((c) & 0x1F)))
@@ -969,7 +956,7 @@ pppgetm(struct ppp_softc *sc)
 	*mp = m;
 	MCLGET(m, M_DONTWAIT);
 	}
-	len -= M_DATASIZE(m);
+	len -= M_BUFSIZE(m);
 	mp = >m_next;
 }
 }
@@ -1137,7 +1124,7 @@ pppinput(int c, struct tty *tp)
 	}
 	m = sc->sc_m;
 	m->m_len = 0;
-	m->m_data = M_DATASTART(sc->sc_m);
+	MRESETDATA(m);
 	sc->sc_mc = m;
 	sc->sc_mp = mtod(m, char *);
 	sc->sc_fcs = PPP_INITFCS;
@@ -1193,7 +1180,7 @@ pppinput(int c, struct tty *tp)
 	}
 	sc->sc_mc = m = m->m_next;
 	m->m_len = 0;
-	m->m_data = M_DATASTART(m);
+	MRESETDATA(m);
 	sc->sc_mp = mtod(m, char *);
 }