Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/powerpc sprintf -> snprintf



details:   https://anonhg.NetBSD.org/src/rev/02764342bd2d
branches:  trunk
changeset: 328075:02764342bd2d
user:      matt <matt%NetBSD.org@localhost>
date:      Tue Mar 25 16:39:27 2014 +0000

description:
sprintf -> snprintf

diffstat:

 sys/arch/powerpc/oea/ofwoea_machdep.c     |   6 +++---
 sys/arch/powerpc/pci/pci_machdep_common.c |   6 +++---
 sys/arch/powerpc/pci/pci_machdep_ofw.c    |  20 ++++++++++----------
 3 files changed, 16 insertions(+), 16 deletions(-)

diffs (127 lines):

diff -r 7bcb2e13bd2c -r 02764342bd2d sys/arch/powerpc/oea/ofwoea_machdep.c
--- a/sys/arch/powerpc/oea/ofwoea_machdep.c     Tue Mar 25 16:30:28 2014 +0000
+++ b/sys/arch/powerpc/oea/ofwoea_machdep.c     Tue Mar 25 16:39:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ofwoea_machdep.c,v 1.37 2014/03/03 15:36:36 macallan Exp $ */
+/* $NetBSD: ofwoea_machdep.c,v 1.38 2014/03/25 16:41:37 matt Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.37 2014/03/03 15:36:36 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ofwoea_machdep.c,v 1.38 2014/03/25 16:41:37 matt Exp $");
 
 #include "opt_ppcarch.h"
 #include "opt_compat_netbsd.h"
@@ -191,7 +191,7 @@
 
 #if defined(MULTIPROCESSOR) && defined(ofppc)
        for (i=1; i < CPU_MAXNUM; i++) {
-               sprintf(cpupath, "/cpus/@%x", i);
+               snprintf(cpupath, sizeof(cpupath), "/cpus/@%x", i);
                node = OF_finddevice(cpupath);
                if (node <= 0)
                        continue;
diff -r 7bcb2e13bd2c -r 02764342bd2d sys/arch/powerpc/pci/pci_machdep_common.c
--- a/sys/arch/powerpc/pci/pci_machdep_common.c Tue Mar 25 16:30:28 2014 +0000
+++ b/sys/arch/powerpc/pci/pci_machdep_common.c Tue Mar 25 16:39:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep_common.c,v 1.18 2013/04/28 00:45:45 macallan Exp $ */
+/* $NetBSD: pci_machdep_common.c,v 1.19 2014/03/25 16:40:28 matt Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep_common.c,v 1.18 2013/04/28 00:45:45 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep_common.c,v 1.19 2014/03/25 16:40:28 matt Exp $");
 
 #define _POWERPC_BUS_DMA_PRIVATE
 
@@ -99,7 +99,7 @@
                panic("pci_intr_string: bogus handle 0x%x", ih);
 #endif
 
-       sprintf(irqstr, "irq %d", ih);
+       snprintf(irqstr, sizeof(irqstr), "irq %d", ih);
        return (irqstr);
        
 }
diff -r 7bcb2e13bd2c -r 02764342bd2d sys/arch/powerpc/pci/pci_machdep_ofw.c
--- a/sys/arch/powerpc/pci/pci_machdep_ofw.c    Tue Mar 25 16:30:28 2014 +0000
+++ b/sys/arch/powerpc/pci/pci_machdep_ofw.c    Tue Mar 25 16:39:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pci_machdep_ofw.c,v 1.19 2013/11/03 22:22:03 mrg Exp $ */
+/* $NetBSD: pci_machdep_ofw.c,v 1.20 2014/03/25 16:39:27 matt Exp $ */
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: pci_machdep_ofw.c,v 1.19 2013/11/03 22:22:03 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pci_machdep_ofw.c,v 1.20 2014/03/25 16:39:27 matt Exp $");
 
 #include <sys/types.h>
 #include <sys/param.h>
@@ -238,12 +238,12 @@
                        sub = prop_dictionary_create_with_capacity(4);
                pin = map[i*reclen + acells];
                intr_num = prop_number_create_integer(map[i*reclen + acells + icells + 1] + picnodes[pic].offset);
-               sprintf(key, "pin-%c", 'A' + (pin-1));
+               snprintf(key, sizeof(key), "pin-%c", 'A' + (pin-1));
                prop_dictionary_set(sub, key, intr_num);
                prop_object_release(intr_num);
                /* should we care about level? */
 
-               sprintf(key, "devfunc-%d", dev*0x8 + func);
+               snprintf(key, sizeof(key), "devfunc-%d", dev*0x8 + func);
                prop_dictionary_set(dict, key, sub);
                if (curdev != dev) {
                        prop_object_release(sub);
@@ -293,10 +293,10 @@
                        if (OF_getprop(node, "interrupts", &pin, 4) < 0)
                                pin = 1;
                        intr_num = prop_number_create_integer(irqs[0]);
-                       sprintf(key, "pin-%c", 'A' + (pin-1));
+                       snprintf(key, sizeof(key), "pin-%c", 'A' + (pin-1));
                        prop_dictionary_set(sub, key, intr_num);
                        prop_object_release(intr_num);
-                       sprintf(key, "devfunc-%d", dev*0x8 + func);
+                       snprintf(key, sizeof(key), "devfunc-%d", dev*0x8 + func);
                        prop_dictionary_set(dict, key, sub);
                        prop_object_release(sub);
                        foundirqs++;
@@ -331,10 +331,10 @@
                        if (OF_getprop(node, "interrupts", &pin, 4) < 0)
                                pin = 1;
                        intr_num = prop_number_create_integer(irq);
-                       sprintf(key, "pin-%c", 'A' + (pin-1));
+                       snprintf(key, sizeof(key), "pin-%c", 'A' + (pin-1));
                        prop_dictionary_set(sub, key, intr_num);
                        prop_object_release(intr_num);
-                       sprintf(key, "devfunc-%d", dev*0x8 + func);
+                       snprintf(key, sizeof(key), "devfunc-%d", dev*0x8 + func);
                        prop_dictionary_set(dict, key, sub);
                        prop_object_release(sub);
                }
@@ -430,11 +430,11 @@
                goto bad;
        }
 
-       sprintf(key, "devfunc-%d", dev*0x8 + func);
+       snprintf(key, sizeof(key), "devfunc-%d", dev*0x8 + func);
        devsub = prop_dictionary_get(dict, key);
        if (devsub == NULL)
                goto bad;
-       sprintf(key, "pin-%c", 'A' + (pin-1));
+       snprintf(key, sizeof(key), "pin-%c", 'A' + (pin-1));
        pinsub = prop_dictionary_get(devsub, key);
        if (pinsub == NULL)
                goto bad;



Home | Main Index | Thread Index | Old Index