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] [XEN][POWERPC] Fix allocation error for x

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] [XEN][POWERPC] Fix allocation error for xencomm "mini" descriptors.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Tue, 19 Sep 2006 10:03:11 +0000
Delivery-date: Tue, 19 Sep 2006 03:04:26 -0700
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 Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID 88fb77ac4f091659c1fdf74ebbaca1a9cdd3871c
# Parent  fcc0efacc17a894d8bbb3f1878fe878bf005f8e9
[XEN][POWERPC] Fix allocation error for xencomm "mini" descriptors.

Previous code worked correctly only if the allocated structure fit in the same
page as the base address. If the structure did not fit, the computation for the
allocation was incorrect. Noticed by Kiyokuni KAWACHIYA <KAWATIYA@xxxxxxxxxx>.

Signed-off-by: Maria Butrico <butrico@xxxxxxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 xen/arch/powerpc/of_handler/xencomm.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r fcc0efacc17a -r 88fb77ac4f09 xen/arch/powerpc/of_handler/xencomm.c
--- a/xen/arch/powerpc/of_handler/xencomm.c     Fri Sep 08 10:22:45 2006 -0500
+++ b/xen/arch/powerpc/of_handler/xencomm.c     Fri Sep 08 10:23:56 2006 -0500
@@ -50,18 +50,18 @@ static void *__xencomm_alloc_mini(void *
 static void *__xencomm_alloc_mini(void *area, int arealen)
 {
     unsigned long base = (unsigned long)area;
-    unsigned int pageoffset;
+    unsigned int left_in_page;
 
-    pageoffset = base % PAGE_SIZE;
+    left_in_page = PAGE_SIZE - base % PAGE_SIZE;
 
     /* we probably fit right at the front of area */
-    if ((PAGE_SIZE - pageoffset) >= sizeof(struct xencomm_mini)) {
+    if (left_in_page >= sizeof(struct xencomm_mini)) {
         return area;
     }
 
     /* if not, see if area is big enough to advance to the next page */
-    if ((arealen - pageoffset) >= sizeof(struct xencomm_mini))
-        return (void *)(base + pageoffset);
+    if ((arealen - left_in_page) >= sizeof(struct xencomm_mini))
+        return (void *)(base + left_in_page);
 
     /* area was too small */
     return NULL;

_______________________________________________
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] [XEN][POWERPC] Fix allocation error for xencomm "mini" descriptors., Xen patchbot-unstable <=