All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] sprintf -> snprintf transition
@ 2007-01-30 15:32 Christoph Egger
  0 siblings, 0 replies; only message in thread
From: Christoph Egger @ 2007-01-30 15:32 UTC (permalink / raw)
  To: xen-devel

[-- Attachment #1: Type: text/plain, Size: 77 bytes --]


The x86 changes.

Signed-off-by: Christoph Egger <Christoph.Egger@amd.com>


[-- Attachment #2: xen_stringbound_x86.diff --]
[-- Type: text/x-diff, Size: 2655 bytes --]

diff -r 5e8da0663ff8 xen/arch/x86/setup.c
--- a/xen/arch/x86/setup.c	Tue Jan 30 01:23:58 2007 +0000
+++ b/xen/arch/x86/setup.c	Tue Jan 30 16:13:23 2007 +0100
@@ -803,57 +803,46 @@ void arch_get_xen_caps(xen_capabilities_
 void arch_get_xen_caps(xen_capabilities_info_t info)
 {
     char *p = info;
-    int i = 0;
     int major = xen_major_version();
     int minor = xen_minor_version();
 
 #if defined(CONFIG_X86_32) && !defined(CONFIG_X86_PAE)
 
-    i = snprintf(p, sizeof(xen_capabilities_info_t),
+    p += snprintf(p, sizeof(xen_capabilities_info_t),
                  "xen-%d.%d-x86_32 ", major, minor);
-    p += i;
     if ( hvm_enabled ) {
-        i = snprintf(p, sizeof(xen_capabilities_info_t) - i,
+        p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
 		"hvm-%d.%d-x86_32 ", major, minor);
-	p += i;
     }
 
 #elif defined(CONFIG_X86_32) && defined(CONFIG_X86_PAE)
 
-    i = snprintf(p, sizeof(xen_capabilities_info_t),
+    p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                  "xen-%d.%d-x86_32p ", major, minor);
-    p += i;
     if ( hvm_enabled )
     {
-        i = snprintf(p, sizeof(xen_capabilities_info_t),
+        p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                      "hvm-%d.%d-x86_32 ", major, minor);
-        p += i;
-        i = snprintf(p, sizeof(xen_capabilities_info_t) - i,
+        p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                      "hvm-%d.%d-x86_32p ", major, minor);
-        p += i;
     }
 
 #elif defined(CONFIG_X86_64)
 
-    i = snprintf(p, sizeof(xen_capabilities_info_t),
+    p += snprintf(p, sizeof(xen_capabilities_info_t),
                  "xen-%d.%d-x86_64 ", major, minor);
-    p += i;
 #ifdef CONFIG_COMPAT
-    i = snprintf(p, sizeof(xen_capabilities_info_t) - i,
+    p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                 "xen-%d.%d-x86_32p ", major, minor);
-    p += i;
 #endif
     if ( hvm_enabled )
     {
-        i = snprintf(p, sizeof(xen_capabilities_info_t) - i,
+        p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                      "hvm-%d.%d-x86_32 ", major, minor);
-        p += i;
-        i = snprintf(p, sizeof(xen_capabilities_info_t) - i,
+        p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                      "hvm-%d.%d-x86_32p ", major, minor);
-        p += i;
-        i = snprintf(p, sizeof(xen_capabilities_info_t) - i,
+        p += snprintf(p, sizeof(xen_capabilities_info_t) - (p - info),
                      "hvm-%d.%d-x86_64 ", major, minor);
-        p += i;
     }
 
 #else

[-- Attachment #3: Type: text/plain, Size: 138 bytes --]

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-01-30 15:32 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-01-30 15:32 [PATCH 1/2] sprintf -> snprintf transition Christoph Egger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.