WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] [xen-unstable] ia64, ppc: Remove uses of sprintf().

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] ia64, ppc: Remove uses of sprintf().
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 31 Jan 2007 07:05:26 -0800
Delivery-date: Wed, 31 Jan 2007 08:10:56 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Keir Fraser <keir@xxxxxxxxxxxxx>
# Date 1170173656 0
# Node ID bd69e83b65ea5c01e3d93d37b1e873f6204b4b7e
# Parent  300c47bec138704d4753675f293b76ebb702da82
ia64, ppc: Remove uses of sprintf().
Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx>
---
 xen/arch/ia64/linux-xen/perfmon.c           |    2 +-
 xen/arch/ia64/linux-xen/setup.c             |    4 ++--
 xen/arch/ia64/linux-xen/sn/kernel/io_init.c |    4 ++--
 xen/arch/ia64/linux-xen/unaligned.c         |    2 +-
 xen/arch/ia64/xen/domain.c                  |    2 +-
 xen/arch/ia64/xen/gdbstub.c                 |   14 +++++++-------
 xen/arch/ia64/xen/xensetup.c                |    4 ++--
 xen/arch/powerpc/domain_build.c             |    2 +-
 8 files changed, 17 insertions(+), 17 deletions(-)

diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/linux-xen/perfmon.c
--- a/xen/arch/ia64/linux-xen/perfmon.c Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/ia64/linux-xen/perfmon.c Tue Jan 30 16:14:16 2007 +0000
@@ -2305,7 +2305,7 @@ pfm_alloc_fd(struct file **cfile)
        inode->i_uid  = current->fsuid;
        inode->i_gid  = current->fsgid;
 
-       sprintf(name, "[%lu]", inode->i_ino);
+       snprintf(name, sizeof(name), "[%lu]", inode->i_ino);
        this.name = name;
        this.len  = strlen(name);
        this.hash = inode->i_ino;
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/linux-xen/setup.c
--- a/xen/arch/ia64/linux-xen/setup.c   Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/ia64/linux-xen/setup.c   Tue Jan 30 16:14:16 2007 +0000
@@ -550,7 +550,7 @@ show_cpuinfo (struct seq_file *m, void *
        switch (c->family) {
              case 0x07:        memcpy(family, "Itanium", 8); break;
              case 0x1f:        memcpy(family, "Itanium 2", 10); break;
-             default:          sprintf(family, "%u", c->family); break;
+             default:          snprintf(family, sizeof(family), "%u", 
c->family); break;
        }
 
        /* build the feature string: */
@@ -572,7 +572,7 @@ show_cpuinfo (struct seq_file *m, void *
                /* print unknown features as a hex value: */
                if (sep)
                        *cp++ = sep;
-               sprintf(cp, " 0x%lx", mask);
+               snprintf(cp, sizeof(features) - (cp - features), " 0x%lx", 
mask);
        }
 
        seq_printf(m,
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/linux-xen/sn/kernel/io_init.c
--- a/xen/arch/ia64/linux-xen/sn/kernel/io_init.c       Tue Jan 30 16:09:16 
2007 +0000
+++ b/xen/arch/ia64/linux-xen/sn/kernel/io_init.c       Tue Jan 30 16:14:16 
2007 +0000
@@ -754,7 +754,7 @@ void sn_generate_path(struct pci_bus *pc
        geoid = cnodeid_get_geoid(cnode);
        moduleid = geo_module(geoid);
 
-       sprintf(address, "module_%c%c%c%c%.2d",
+       snprintf(address, 15, "module_%c%c%c%c%.2d",
                '0'+RACK_GET_CLASS(MODULE_GET_RACK(moduleid)),
                '0'+RACK_GET_GROUP(MODULE_GET_RACK(moduleid)),
                '0'+RACK_GET_NUM(MODULE_GET_RACK(moduleid)),
@@ -764,7 +764,7 @@ void sn_generate_path(struct pci_bus *pc
        bricktype = MODULE_GET_BTYPE(moduleid);
        if ((bricktype == L1_BRICKTYPE_191010) ||
            (bricktype == L1_BRICKTYPE_1932))
-                       sprintf(address, "%s^%d", address, geo_slot(geoid));
+                       snprintf(address, 15+8, "%s^%d", address, 
geo_slot(geoid));
 }
 #endif
 
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/linux-xen/unaligned.c
--- a/xen/arch/ia64/linux-xen/unaligned.c       Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/ia64/linux-xen/unaligned.c       Tue Jan 30 16:14:16 2007 +0000
@@ -1792,7 +1792,7 @@ printk("ia64_handle_unaligned: called, n
                        char buf[200];  /* comm[] is at most 16 bytes... */
                        size_t len;
 
-                       len = sprintf(buf, "%s(%d): unaligned access to 
0x%016lx, "
+                       len = snprintf(buf, sizeof(buf), "%s(%d): unaligned 
access to 0x%016lx, "
                                      "ip=0x%016lx\n\r", current->comm, 
current->pid,
                                      ifa, regs->cr_iip + ipsr->ri);
                        /*
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/xen/domain.c
--- a/xen/arch/ia64/xen/domain.c        Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/ia64/xen/domain.c        Tue Jan 30 16:14:16 2007 +0000
@@ -1124,7 +1124,7 @@ int construct_dom0(struct domain *d,
                panic("can't allocate start info page");
        si = page_to_virt(start_info_page);
        memset(si, 0, PAGE_SIZE);
-       sprintf(si->magic, "xen-%i.%i-ia64",
+       snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-ia64",
                xen_major_version(), xen_minor_version());
        si->nr_pages     = max_pages;
        si->flags = SIF_INITDOMAIN|SIF_PRIVILEGED;
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/xen/gdbstub.c
--- a/xen/arch/ia64/xen/gdbstub.c       Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/ia64/xen/gdbstub.c       Tue Jan 30 16:14:16 2007 +0000
@@ -289,13 +289,13 @@ gdb_arch_read_reg(unsigned long regnum, 
        }
 
        dbg_printk("Register read regnum = 0x%lx, val = 0x%lx\n", regnum, reg); 
-       sprintf(buf, "%.08lx", swab64(reg));
+       snprintf(buf, sizeof(buf), "%.08lx", swab64(reg));
 out:
        return gdb_send_reply(buf, ctx);
 
 out_err:
        dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
-       sprintf(buf, "%s", "x");
+       safe_strcpy(buf, "x");
        goto out;
 }
 #else
@@ -756,19 +756,19 @@ gdb_arch_read_reg(unsigned long regnum, 
        if (arg.error > 0) {
                // notify gdb that this register is not supported.
                // see fetch_register_using_p() in gdb/remote.c.
-               sprintf(buf, "%s", "x");
+               safe_strcpy(buf, "x");
        } else if (IA64_FR0_REGNUM <= regnum && regnum <= IA64_FR0_REGNUM + 
127) {
-               sprintf(buf, "%.016lx", swab64(freg.u.bits[0]));
-               sprintf(buf + 16, "%.016lx", swab64(freg.u.bits[1]));
+               snprintf(buf, sizeof(buf), "%.016lx", swab64(freg.u.bits[0]));
+               snprintf(buf + 16, sizeof(buf) - 16, "%.016lx", 
swab64(freg.u.bits[1]));
        } else {
-               sprintf(buf, "%.016lx", swab64(reg));
+               snprintf(buf, sizeof(buf), "%.016lx", swab64(reg));
        }
 out:
        return gdb_send_reply(buf, ctx);
 
 out_err:
        dbg_printk("Register read unsupported regnum = 0x%lx\n", regnum);
-       sprintf(buf, "%s", "E0");
+       safe_strcpy(buf, "E0");
        goto out;
 }
 #endif
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/ia64/xen/xensetup.c      Tue Jan 30 16:14:16 2007 +0000
@@ -551,10 +551,10 @@ void arch_get_xen_caps(xen_capabilities_
     int major = xen_major_version();
     int minor = xen_minor_version();
 
-    p += sprintf(p,"xen-%d.%d-ia64 ", major, minor);
+    p += snprintf(p,sizeof(info), "xen-%d.%d-ia64 ", major, minor);
 
     if (vmx_enabled)
-        p += sprintf(p,"hvm-%d.%d-ia64 ", major, minor);
+        p += snprintf(p,sizeof(info) - (p - info),"hvm-%d.%d-ia64 ", major, 
minor);
 
     *(p-1) = 0;
 
diff -r 300c47bec138 -r bd69e83b65ea xen/arch/powerpc/domain_build.c
--- a/xen/arch/powerpc/domain_build.c   Tue Jan 30 16:09:16 2007 +0000
+++ b/xen/arch/powerpc/domain_build.c   Tue Jan 30 16:14:16 2007 +0000
@@ -185,7 +185,7 @@ int construct_dom0(struct domain *d,
     si = (start_info_t *)(rma_addr(&d->arch, RMA_START_INFO) + rma);
     printk("xen_start_info: %p\n", si);
 
-    sprintf(si->magic, "xen-%i.%i-powerpc%d%s",
+    snprintf(si->magic, sizeof(si->magic), "xen-%i.%i-powerpc%d%s",
             xen_major_version(), xen_minor_version(), BITS_PER_LONG, "HV");
     si->flags = SIF_PRIVILEGED | SIF_INITDOMAIN;
 

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] ia64, ppc: Remove uses of sprintf()., Xen patchbot-unstable <=