Module Name:    src
Committed By:   maya
Date:           Thu Jan 12 18:26:08 UTC 2017

Modified Files:
        src/sys/dev/usb: if_aue.c if_axe.c if_cdce.c if_cue.c if_kue.c
            if_udav.c if_upl.c if_url.c

Log Message:
Appease coverity which is having nightmares about strings not being
null-terminated by using strlcpy rather than strncpy when it doesn't
matter.

ok christos.


To generate a diff of this commit:
cvs rdiff -u -r1.140 -r1.141 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.79 -r1.80 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/if_cdce.c
cvs rdiff -u -r1.75 -r1.76 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.88 -r1.89 src/sys/dev/usb/if_kue.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.58 -r1.59 src/sys/dev/usb/if_upl.c
cvs rdiff -u -r1.55 -r1.56 src/sys/dev/usb/if_url.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_aue.c
diff -u src/sys/dev/usb/if_aue.c:1.140 src/sys/dev/usb/if_aue.c:1.141
--- src/sys/dev/usb/if_aue.c:1.140	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_aue.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_aue.c,v 1.140 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_aue.c,v 1.141 2017/01/12 18:26:08 maya Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -78,7 +78,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.140 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_aue.c,v 1.141 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -836,7 +836,7 @@ aue_attach(device_t parent, device_t sel
 	ifp->if_ioctl = aue_ioctl;
 	ifp->if_start = aue_start;
 	ifp->if_watchdog = aue_watchdog;
-	strncpy(ifp->if_xname, device_xname(sc->aue_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->aue_dev), IFNAMSIZ);
 
 	IFQ_SET_READY(&ifp->if_snd);
 

Index: src/sys/dev/usb/if_axe.c
diff -u src/sys/dev/usb/if_axe.c:1.79 src/sys/dev/usb/if_axe.c:1.80
--- src/sys/dev/usb/if_axe.c:1.79	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_axe.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_axe.c,v 1.79 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_axe.c,v 1.80 2017/01/12 18:26:08 maya Exp $	*/
 /*	$OpenBSD: if_axe.c,v 1.137 2016/04/13 11:03:37 mpi Exp $ */
 
 /*
@@ -87,7 +87,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.79 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_axe.c,v 1.80 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -988,7 +988,7 @@ axe_attach(device_t parent, device_t sel
 	/* Initialize interface info.*/
 	ifp = &sc->sc_if;
 	ifp->if_softc = sc;
-	strncpy(ifp->if_xname, devname, IFNAMSIZ);
+	strlcpy(ifp->if_xname, devname, IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_ioctl = axe_ioctl;
 	ifp->if_start = axe_start;

Index: src/sys/dev/usb/if_cdce.c
diff -u src/sys/dev/usb/if_cdce.c:1.43 src/sys/dev/usb/if_cdce.c:1.44
--- src/sys/dev/usb/if_cdce.c:1.43	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_cdce.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cdce.c,v 1.43 2016/12/15 09:28:06 ozaki-r Exp $ */
+/*	$NetBSD: if_cdce.c,v 1.44 2017/01/12 18:26:08 maya Exp $ */
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000-2003 Bill Paul <wp...@windriver.com>
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.43 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cdce.c,v 1.44 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -281,7 +281,7 @@ cdce_attach(device_t parent, device_t se
 	ifp->if_ioctl = cdce_ioctl;
 	ifp->if_start = cdce_start;
 	ifp->if_watchdog = cdce_watchdog;
-	strncpy(ifp->if_xname, device_xname(sc->cdce_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->cdce_dev), IFNAMSIZ);
 
 	IFQ_SET_READY(&ifp->if_snd);
 

Index: src/sys/dev/usb/if_cue.c
diff -u src/sys/dev/usb/if_cue.c:1.75 src/sys/dev/usb/if_cue.c:1.76
--- src/sys/dev/usb/if_cue.c:1.75	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_cue.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cue.c,v 1.75 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_cue.c,v 1.76 2017/01/12 18:26:08 maya Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *	Bill Paul <wp...@ee.columbia.edu>.  All rights reserved.
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.75 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_cue.c,v 1.76 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -542,7 +542,7 @@ cue_attach(device_t parent, device_t sel
 	ifp->if_ioctl = cue_ioctl;
 	ifp->if_start = cue_start;
 	ifp->if_watchdog = cue_watchdog;
-	strncpy(ifp->if_xname, device_xname(sc->cue_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->cue_dev), IFNAMSIZ);
 
 	IFQ_SET_READY(&ifp->if_snd);
 

Index: src/sys/dev/usb/if_kue.c
diff -u src/sys/dev/usb/if_kue.c:1.88 src/sys/dev/usb/if_kue.c:1.89
--- src/sys/dev/usb/if_kue.c:1.88	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_kue.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_kue.c,v 1.88 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_kue.c,v 1.89 2017/01/12 18:26:08 maya Exp $	*/
 
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
@@ -71,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.88 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_kue.c,v 1.89 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -500,7 +500,7 @@ kue_attach(device_t parent, device_t sel
 	ifp->if_ioctl = kue_ioctl;
 	ifp->if_start = kue_start;
 	ifp->if_watchdog = kue_watchdog;
-	strncpy(ifp->if_xname, device_xname(sc->kue_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->kue_dev), IFNAMSIZ);
 
 	IFQ_SET_READY(&ifp->if_snd);
 

Index: src/sys/dev/usb/if_udav.c
diff -u src/sys/dev/usb/if_udav.c:1.50 src/sys/dev/usb/if_udav.c:1.51
--- src/sys/dev/usb/if_udav.c:1.50	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_udav.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_udav.c,v 1.50 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_udav.c,v 1.51 2017/01/12 18:26:08 maya Exp $	*/
 /*	$nabe: if_udav.c,v 1.3 2003/08/21 16:57:19 nabe Exp $	*/
 
 /*
@@ -45,7 +45,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.50 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_udav.c,v 1.51 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -283,7 +283,7 @@ udav_attach(device_t parent, device_t se
 	ifp = GET_IFP(sc);
 	ifp->if_softc = sc;
 	ifp->if_mtu = ETHERMTU;
-	strncpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = udav_start;
 	ifp->if_ioctl = udav_ioctl;

Index: src/sys/dev/usb/if_upl.c
diff -u src/sys/dev/usb/if_upl.c:1.58 src/sys/dev/usb/if_upl.c:1.59
--- src/sys/dev/usb/if_upl.c:1.58	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_upl.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_upl.c,v 1.58 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_upl.c,v 1.59 2017/01/12 18:26:08 maya Exp $	*/
 /*
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.58 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_upl.c,v 1.59 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -295,7 +295,7 @@ upl_attach(device_t parent, device_t sel
 	ifp->if_ioctl = upl_ioctl;
 	ifp->if_start = upl_start;
 	ifp->if_watchdog = upl_watchdog;
-	strncpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(sc->sc_dev), IFNAMSIZ);
 
 	ifp->if_type = IFT_OTHER;
 	ifp->if_addrlen = 0;

Index: src/sys/dev/usb/if_url.c
diff -u src/sys/dev/usb/if_url.c:1.55 src/sys/dev/usb/if_url.c:1.56
--- src/sys/dev/usb/if_url.c:1.55	Thu Dec 15 09:28:06 2016
+++ src/sys/dev/usb/if_url.c	Thu Jan 12 18:26:08 2017
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_url.c,v 1.55 2016/12/15 09:28:06 ozaki-r Exp $	*/
+/*	$NetBSD: if_url.c,v 1.56 2017/01/12 18:26:08 maya Exp $	*/
 
 /*
  * Copyright (c) 2001, 2002
@@ -44,7 +44,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.55 2016/12/15 09:28:06 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_url.c,v 1.56 2017/01/12 18:26:08 maya Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -277,7 +277,7 @@ url_attach(device_t parent, device_t sel
 	ifp = GET_IFP(sc);
 	ifp->if_softc = sc;
 	ifp->if_mtu = ETHERMTU;
-	strncpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
+	strlcpy(ifp->if_xname, device_xname(self), IFNAMSIZ);
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_start = url_start;
 	ifp->if_ioctl = url_ioctl;

Reply via email to