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

[Xen-devel] [PATCH] stubdom: make xc_map_foreign_ranges use malloc inste

To: Todd Deshane <deshantm@xxxxxxxxx>
Subject: [Xen-devel] [PATCH] stubdom: make xc_map_foreign_ranges use malloc instead of stack space [Was: PV Grub Questions]
From: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>
Date: Wed, 27 Aug 2008 16:55:11 +0100
Cc: xen-devel mailing list <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Wed, 27 Aug 2008 08:55:39 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1e16a9ed0808261257p763cb14uc6a3b28513cf94d2@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Mail-followup-to: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>, Todd Deshane <deshantm@xxxxxxxxx>, xen-devel mailing list <xen-devel@xxxxxxxxxxxxxxxxxxx>
References: <1e16a9ed0808261257p763cb14uc6a3b28513cf94d2@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.12-2006-07-14
Should be applied to the 3.3 tree as well.



stubdom: make xc_map_foreign_ranges use malloc instead of stack space

Signed-off-by: Samuel Thibault <samuel.thibault@xxxxxxxxxxxxx>

diff -r 96bbda1afb81 tools/libxc/xc_minios.c
--- a/tools/libxc/xc_minios.c   Wed Aug 27 15:53:44 2008 +0100
+++ b/tools/libxc/xc_minios.c   Wed Aug 27 16:50:16 2008 +0100
@@ -80,9 +80,10 @@ void *xc_map_foreign_ranges(int xc_handl
                             size_t size, int prot, size_t chunksize,
                             privcmd_mmap_entry_t entries[], int nentries)
 {
-    unsigned long mfns[size / PAGE_SIZE];
+    unsigned long *mfns;
     int i, j, n;
     unsigned long pt_prot = 0;
+    void *ret;
 #ifdef __ia64__
     /* TODO */
 #else
@@ -92,12 +93,16 @@ void *xc_map_foreign_ranges(int xc_handl
        pt_prot = L1_PROT;
 #endif
 
+    mfns = malloc((size / PAGE_SIZE) * sizeof(*mfns));
+
     n = 0;
     for (i = 0; i < nentries; i++)
         for (j = 0; j < chunksize / PAGE_SIZE; j++)
             mfns[n++] = entries[i].mfn + j;
 
-    return map_frames_ex(mfns, n, 1, 0, 1, dom, 0, pt_prot);
+    ret = map_frames_ex(mfns, n, 1, 0, 1, dom, 0, pt_prot);
+    free(mfns);
+    return ret;
 }
 
 

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

<Prev in Thread] Current Thread [Next in Thread>