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] [patch] xencomm with empty buffers

To: Tony Breeds <tony@xxxxxxxxxxxxxxxxxx>
Subject: [XenPPC] [patch] xencomm with empty buffers
From: Hollis Blanchard <hollisb@xxxxxxxxxx>
Date: Fri, 08 Sep 2006 15:16:56 -0500
Cc: xen-ppc-devel <xen-ppc-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 08 Sep 2006 13:16:41 -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>
Organization: IBM Linux Technology Center
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
Hi Tony, you mentioned on IRC that your xm top problem was exascerbated
by passing a non-NULL pointer with bytes==0 to xencomm_create(). Does
this patch catch the problem without breaking anything else?

diff -r cc44870e4353 drivers/xen/core/xencomm.c
--- a/drivers/xen/core/xencomm.c        Fri Sep 08 10:17:30 2006 -0500
+++ b/drivers/xen/core/xencomm.c        Fri Sep 08 13:09:40 2006 -0700
@@ -51,8 +51,6 @@ static int xencomm_init(struct xencomm_d
 {
        unsigned long recorded = 0;
        int i = 0;
-
-       BUG_ON((buffer == NULL) && (bytes > 0));

        /* record the physical pages used */
        if (buffer == NULL)
@@ -121,11 +119,14 @@ int xencomm_create(void *buffer, unsigne
        int rc;

        if (xencomm_debug) {
-               if ((!buffer) || (bytes == 0)) {
-                       printk(KERN_ERR "%s: NULL buffer\n", __func__);
-                       return 0;
-               }
                printk("%s: %p[%ld]\n", __func__, buffer, bytes);
+       }
+
+       if (bytes == 0) {
+               /* if it's a NULL pointer, don't even bother */
+               BUG_ON(buffer != NULL);
+               desc = NULL;
+               goto out;
        }

        desc = xencomm_alloc(gfp_mask);
@@ -141,6 +142,7 @@ int xencomm_create(void *buffer, unsigne
                return rc;
        }

+out:
        *ret = desc;
        return 0;
 }


-- 
Hollis Blanchard
IBM Linux Technology Center


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

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