[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[XenPPC] [patch] xencomm with empty buffers



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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.