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-3.1-testing] libxc: Minor clean up of xc_core, and

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-3.1-testing] libxc: Minor clean up of xc_core, and fix for -fstrict-overflow.
From: "Xen patchbot-3.1-testing" <patchbot-3.1-testing@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 10 Dec 2007 03:10:38 -0800
Delivery-date: Mon, 10 Dec 2007 04:46:32 -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.fraser@xxxxxxxxxx>
# Date 1196960458 0
# Node ID 3471953685684da80883859adb85ab306768bc2f
# Parent  a4b96d2204fe65d7a58877b1405900e35715eca3
libxc: Minor clean up of xc_core, and fix for -fstrict-overflow.
Signed-off-by: Isaku Yamahata <yamahata@xxxxxxxxxxxxx>
xen-unstable changeset:   16412:7186e9611d55dc5ab6fd9c6a8bd6e5c674be8c10
xen-unstable date:        Thu Nov 22 10:40:45 2007 +0000
---
 tools/libxc/xc_core.c     |   16 +++++++++++-----
 tools/libxc/xc_core_x86.c |    4 ++--
 2 files changed, 13 insertions(+), 7 deletions(-)

diff -r a4b96d2204fe -r 347195368568 tools/libxc/xc_core.c
--- a/tools/libxc/xc_core.c     Thu Dec 06 17:00:21 2007 +0000
+++ b/tools/libxc/xc_core.c     Thu Dec 06 17:00:58 2007 +0000
@@ -119,16 +119,22 @@ xc_core_strtab_get(struct xc_core_strtab
     uint16_t ret = 0;
     uint16_t len = strlen(name) + 1;
 
+    if ( strtab->current > UINT16_MAX - len )
+    {
+        PERROR("too long string table");
+        errno = E2BIG;
+        return ret;
+    }
+    
     if ( strtab->current + len > strtab->max )
     {
         char *tmp;
-        if ( strtab->max * 2 < strtab->max )
+        if ( strtab->max > UINT16_MAX / 2 )
         {
             PERROR("too long string table");
             errno = ENOMEM;
             return ret;
         }
-
 
         tmp = realloc(strtab->strings, strtab->max * 2);
         if ( tmp == NULL )
@@ -155,8 +161,8 @@ struct xc_core_section_headers {
 
     Elf64_Shdr  *shdrs;
 };
-#define SHDR_INIT       16
-#define SHDR_INC        4U
+#define SHDR_INIT       ((uint16_t)16)
+#define SHDR_INC        ((uint16_t)4)
 
 static struct xc_core_section_headers*
 xc_core_shdr_init(void)
@@ -192,7 +198,7 @@ xc_core_shdr_get(struct xc_core_section_
     if ( sheaders->num == sheaders->num_max )
     {
         Elf64_Shdr *shdrs;
-        if ( sheaders->num_max + SHDR_INC < sheaders->num_max )
+        if ( sheaders->num_max > UINT16_MAX - SHDR_INC )
         {
             errno = E2BIG;
             return NULL;
diff -r a4b96d2204fe -r 347195368568 tools/libxc/xc_core_x86.c
--- a/tools/libxc/xc_core_x86.c Thu Dec 06 17:00:21 2007 +0000
+++ b/tools/libxc/xc_core_x86.c Thu Dec 06 17:00:58 2007 +0000
@@ -86,7 +86,7 @@ xc_core_arch_map_p2m(int xc_handle, xc_d
     }
 
     live_p2m_frame_list =
-        xc_map_foreign_batch(xc_handle, dom, PROT_READ,
+        xc_map_foreign_pages(xc_handle, dom, PROT_READ,
                              live_p2m_frame_list_list,
                              P2M_FLL_ENTRIES);
 
@@ -96,7 +96,7 @@ xc_core_arch_map_p2m(int xc_handle, xc_d
         goto out;
     }
 
-    *live_p2m = xc_map_foreign_batch(xc_handle, dom, PROT_READ,
+    *live_p2m = xc_map_foreign_pages(xc_handle, dom, PROT_READ,
                                     live_p2m_frame_list,
                                     P2M_FL_ENTRIES);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-3.1-testing] libxc: Minor clean up of xc_core, and fix for -fstrict-overflow., Xen patchbot-3.1-testing <=