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

[Xen-changelog] [xen-4.1-testing] bitmap_scnlistprintf() should always zero-terminate its output buffer



# HG changeset patch
# User Jan Beulich <jbeulich@xxxxxxxx>
# Date 1315388399 -3600
# Node ID c4172ba1a98bdc75e99bb2e50ea956adbf9fdbe7
# Parent  6239209bb560b4931d4d97456c82c1a5ca4bd10a
bitmap_scnlistprintf() should always zero-terminate its output buffer

... as long as it has non-zero size. So far this would not happen if
the passed in CPU mask was empty.

Also fix the comment describing the return value to actually match
reality.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
xen-unstable changeset:   23820:ba75234a6f56
xen-unstable date:        Wed Sep 07 10:36:55 2011 +0100
---


diff -r 6239209bb560 -r c4172ba1a98b xen/common/bitmap.c
--- a/xen/common/bitmap.c       Wed Aug 31 15:32:47 2011 +0100
+++ b/xen/common/bitmap.c       Wed Sep 07 10:39:59 2011 +0100
@@ -363,9 +363,8 @@
  * the range.  Output format is compatible with the format
  * accepted as input by bitmap_parselist().
  *
- * The return value is the number of characters which would be
- * generated for the given input, excluding the trailing '\0', as
- * per ISO C99.
+ * The return value is the number of characters which were output,
+ * excluding the trailing '\0'.
  */
 int bitmap_scnlistprintf(char *buf, unsigned int buflen,
        const unsigned long *maskp, int nmaskbits)
@@ -383,6 +382,8 @@
                        rbot = cur;
                }
        }
+       if (!len && buflen)
+               *buf = 0;
        return len;
 }
 EXPORT_SYMBOL(bitmap_scnlistprintf);

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


 


Rackspace

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