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

[Xen-devel] [PATCH] xen-tmem-list-parse: fix ugly parse output



Hmmm... It appears I never posted the corrected version of this patch
so it never made it upstream.  See:

http://lists.xen.org/archives/html/xen-devel/2011-11/msg00587.html 
http://lists.xen.org/archives/html/xen-devel/2011-11/msg02145.html 

It would be good if this very minor fix was also applied to 4.2
(and, if possible, 4.1).

Thanks,
Dan

===================

The program xen-tmem-list-parse parses the output of xm/xl tmem-list
into human-readable format.  A missing NULL terminator sometimes
causes garbage to be spewed where the two-letter pool type
should be output.

Signed-off-by: Dan Magenheimer <dan.magenheimer@xxxxxxxxxx>
---
 tools/misc/xen-tmem-list-parse.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/tools/misc/xen-tmem-list-parse.c b/tools/misc/xen-tmem-list-parse.c
index 977e4d3..f32b107 100644
--- a/tools/misc/xen-tmem-list-parse.c
+++ b/tools/misc/xen-tmem-list-parse.c
@@ -243,6 +243,7 @@ void parse_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     if (pool_type[1] == 'S')
         return; /* no need to repeat print data for shared pools */
     printf("domid%lu,id%lu[%s]:pgp=%llu(max=%llu) obj=%llu(%llu) "
@@ -286,6 +287,7 @@ void parse_shared_pool(char *s)
     unsigned long long flush_objs = parse(s,"ot");
 
     parse_string(s,"PT",pool_type,2);
+    pool_type[2] = '\0';
     parse_sharers(s,"SC",buf,BUFSIZE);
     printf("poolid=%lu[%s] uuid=%llx.%llx, shared-by:%s: "
            "pgp=%llu(max=%llu) obj=%llu(%llu) "
-- 
1.7.1

Attachment: 0001-Fix-ugly-parse-output-for-xen-tmem-list-parse.patch
Description: Binary data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

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