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

[XenPPC] [linux-ppc-2.6] [LINUX][POWERPC] Fix allocation error for xenco

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [linux-ppc-2.6] [LINUX][POWERPC] Fix allocation error for xencomm "mini" descriptors.
From: Xen patchbot-linux-ppc-2.6 <patchbot-linux-ppc-2.6@xxxxxxxxxxxxxxxxxxx>
Date: Fri, 08 Sep 2006 15:31:35 +0000
Delivery-date: Fri, 08 Sep 2006 08:42:53 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Node ID cc44870e435343e40564f210e16d1141a314e593
# Parent  efefb3db340a70a34fd59435a260ebf4e6b8662d
[LINUX][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>
---
 drivers/xen/core/xencomm.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diff -r efefb3db340a -r cc44870e4353 drivers/xen/core/xencomm.c
--- a/drivers/xen/core/xencomm.c        Wed Sep 06 15:39:46 2006 -0500
+++ b/drivers/xen/core/xencomm.c        Fri Sep 08 10:17:30 2006 -0500
@@ -150,18 +150,18 @@ static void *xencomm_alloc_mini(void *ar
 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-ppc-devel mailing list
Xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-ppc-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [linux-ppc-2.6] [LINUX][POWERPC] Fix allocation error for xencomm "mini" descriptors., Xen patchbot-linux-ppc-2 . 6 <=