All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Christoph Egger" <Christoph.Egger@amd.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH 1/2] sprintf -> snprintf transition
Date: Tue, 30 Jan 2007 16:32:07 +0100	[thread overview]
Message-ID: <200701301632.08022.Christoph.Egger@amd.com> (raw)

[-- 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

                 reply	other threads:[~2007-01-30 15:32 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200701301632.08022.Christoph.Egger@amd.com \
    --to=christoph.egger@amd.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.