Module Name:    src
Committed By:   christos
Date:           Wed Mar 26 08:09:07 UTC 2014

Modified Files:
        src/sys/arch/alpha/stand/setnetbootinfo: setnetbootinfo.c
        src/sys/arch/alpha/tc: ioasic.c tc_3000_300.c tc_3000_500.c
        src/sys/arch/alpha/tlsb: tlsb.c

Log Message:
kill sprintf


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 \
    src/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c
cvs rdiff -u -r1.45 -r1.46 src/sys/arch/alpha/tc/ioasic.c
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/alpha/tc/tc_3000_300.c
cvs rdiff -u -r1.31 -r1.32 src/sys/arch/alpha/tc/tc_3000_500.c
cvs rdiff -u -r1.37 -r1.38 src/sys/arch/alpha/tlsb/tlsb.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/alpha/stand/setnetbootinfo/setnetbootinfo.c
diff -u src/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c:1.13 src/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c:1.14
--- src/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c:1.13	Sat Mar 14 17:04:03 2009
+++ src/sys/arch/alpha/stand/setnetbootinfo/setnetbootinfo.c	Wed Mar 26 04:09:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: setnetbootinfo.c,v 1.13 2009/03/14 21:04:03 dsl Exp $ */
+/* $NetBSD: setnetbootinfo.c,v 1.14 2014/03/26 08:09:06 christos Exp $ */
 
 /*
  * Copyright (c) 1997 Christopher G. Demetriou
@@ -139,10 +139,12 @@ main(int argc, char *argv[])
 		outfilename = outfile;
 	else {
 		/* name + 12 for enet addr + '.' before enet addr + NUL */
-		outfilename = malloc(strlen(netboot) + 14);
+		size_t len = strlen(netboot) + 14;
+		outfilename = malloc(len);
 		if (outfilename == NULL)
 			err(1, "malloc of output file name failed");
-		sprintf(outfilename, "%s.%02x%02x%02x%02x%02x%02x", netboot,
+		snprintf(outfilename, len,
+		    "%s.%02x%02x%02x%02x%02x%02x", netboot,
 		    ether_addr->ether_addr_octet[0],
 		    ether_addr->ether_addr_octet[1],
 		    ether_addr->ether_addr_octet[2],

Index: src/sys/arch/alpha/tc/ioasic.c
diff -u src/sys/arch/alpha/tc/ioasic.c:1.45 src/sys/arch/alpha/tc/ioasic.c:1.46
--- src/sys/arch/alpha/tc/ioasic.c:1.45	Sun Feb  5 21:14:16 2012
+++ src/sys/arch/alpha/tc/ioasic.c	Wed Mar 26 04:09:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: ioasic.c,v 1.45 2012/02/06 02:14:16 matt Exp $ */
+/* $NetBSD: ioasic.c,v 1.46 2014/03/26 08:09:06 christos Exp $ */
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.45 2012/02/06 02:14:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ioasic.c,v 1.46 2014/03/26 08:09:06 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -192,13 +192,14 @@ ioasicattach(device_t parent, device_t s
 	 */
 	pevcnt = tc_intr_evcnt(parent, ta->ta_cookie);
 	for (i = 0; i < IOASIC_NCOOKIES; i++) {
+		static const size_t len = 12;
 		ioasicintrs[i].iai_func = ioasic_intrnull;
 		ioasicintrs[i].iai_arg = (void *)i;
 
-		cp = malloc(12, M_DEVBUF, M_NOWAIT);
+		cp = malloc(len, M_DEVBUF, M_NOWAIT);
 		if (cp == NULL)
 			panic("ioasicattach");
-		sprintf(cp, "slot %lu", i);
+		snprintf(cp, len, "slot %lu", i);
 		evcnt_attach_dynamic(&ioasicintrs[i].iai_evcnt,
 		    EVCNT_TYPE_INTR, pevcnt, device_xname(self), cp);
 	}

Index: src/sys/arch/alpha/tc/tc_3000_300.c
diff -u src/sys/arch/alpha/tc/tc_3000_300.c:1.32 src/sys/arch/alpha/tc/tc_3000_300.c:1.33
--- src/sys/arch/alpha/tc/tc_3000_300.c:1.32	Sun Feb  5 21:14:16 2012
+++ src/sys/arch/alpha/tc/tc_3000_300.c	Wed Mar 26 04:09:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tc_3000_300.c,v 1.32 2012/02/06 02:14:16 matt Exp $ */
+/* $NetBSD: tc_3000_300.c,v 1.33 2014/03/26 08:09:06 christos Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.32 2012/02/06 02:14:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tc_3000_300.c,v 1.33 2014/03/26 08:09:06 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -107,13 +107,14 @@ tc_3000_300_intr_setup(void)
 	 * Set up interrupt handlers.
 	 */
 	for (i = 0; i < TC_3000_300_NCOOKIES; i++) {
+		static const size_t len = 12;
 	        tc_3000_300_intr[i].tci_func = tc_3000_300_intrnull;
 	        tc_3000_300_intr[i].tci_arg = (void *)i;
 		
-		cp = malloc(12, M_DEVBUF, M_NOWAIT);
+		cp = malloc(len, M_DEVBUF, M_NOWAIT);
 		if (cp == NULL)
 			panic("tc_3000_300_intr_setup");
-		sprintf(cp, "slot %lu", i);
+		snprintf(cp, len, "slot %lu", i);
 		evcnt_attach_dynamic(&tc_3000_300_intr[i].tci_evcnt,
 		    EVCNT_TYPE_INTR, NULL, "tc", cp);
 	}

Index: src/sys/arch/alpha/tc/tc_3000_500.c
diff -u src/sys/arch/alpha/tc/tc_3000_500.c:1.31 src/sys/arch/alpha/tc/tc_3000_500.c:1.32
--- src/sys/arch/alpha/tc/tc_3000_500.c:1.31	Sun Feb  5 21:14:16 2012
+++ src/sys/arch/alpha/tc/tc_3000_500.c	Wed Mar 26 04:09:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tc_3000_500.c,v 1.31 2012/02/06 02:14:16 matt Exp $ */
+/* $NetBSD: tc_3000_500.c,v 1.32 2014/03/26 08:09:06 christos Exp $ */
 
 /*
  * Copyright (c) 1994, 1995, 1996 Carnegie-Mellon University.
@@ -29,7 +29,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.31 2012/02/06 02:14:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tc_3000_500.c,v 1.32 2014/03/26 08:09:06 christos Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -131,13 +131,14 @@ tc_3000_500_intr_setup(void)
 	 * Set up interrupt handlers.
 	 */
 	for (i = 0; i < TC_3000_500_NCOOKIES; i++) {
+		static const size_t len = 12;
 		tc_3000_500_intr[i].tci_func = tc_3000_500_intrnull;
 		tc_3000_500_intr[i].tci_arg = (void *)i;
 
-		cp = malloc(12, M_DEVBUF, M_NOWAIT);
+		cp = malloc(len, M_DEVBUF, M_NOWAIT);
 		if (cp == NULL)
 			panic("tc_3000_500_intr_setup");
-		sprintf(cp, "slot %lu", i);
+		snprintf(cp, len, "slot %lu", i);
 		evcnt_attach_dynamic(&tc_3000_500_intr[i].tci_evcnt,
 		    EVCNT_TYPE_INTR, NULL, "tc", cp);
 	}

Index: src/sys/arch/alpha/tlsb/tlsb.c
diff -u src/sys/arch/alpha/tlsb/tlsb.c:1.37 src/sys/arch/alpha/tlsb/tlsb.c:1.38
--- src/sys/arch/alpha/tlsb/tlsb.c:1.37	Sun Feb  5 21:14:16 2012
+++ src/sys/arch/alpha/tlsb/tlsb.c	Wed Mar 26 04:09:06 2014
@@ -1,4 +1,4 @@
-/* $NetBSD: tlsb.c,v 1.37 2012/02/06 02:14:16 matt Exp $ */
+/* $NetBSD: tlsb.c,v 1.38 2014/03/26 08:09:06 christos Exp $ */
 /*
  * Copyright (c) 1997 by Matthew Jacob
  * NASA AMES Research Center.
@@ -39,7 +39,7 @@
 
 #include <sys/cdefs.h>			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.37 2012/02/06 02:14:16 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tlsb.c,v 1.38 2014/03/26 08:09:06 christos Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -260,8 +260,8 @@ tlsb_node_type_str(uint32_t dtype)
 		return ("Dual CPU, 16MB cache");
 
 	default:
-		memset(tlsb_line, 0, sizeof(tlsb_line));
-		sprintf(tlsb_line, "unknown, dtype 0x%x", dtype);
+		snprintf(tlsb_line, sizeof(tlsb_line), "unknown, dtype 0x%x",
+		    dtype);
 		return (tlsb_line);
 	}
 	/* NOTREACHED */

Reply via email to