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

[Xen-changelog] [xen master] tools: xen-mceinj: Add missing return value checks



commit 1efe90faa31be104a24fe75323429d227eae1d9f
Author:     Bastian Blank <bastian@xxxxxxxxxxxx>
AuthorDate: Sun Aug 11 22:10:20 2013 +0200
Commit:     Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
CommitDate: Mon Aug 19 15:31:13 2013 +0100

    tools: xen-mceinj: Add missing return value checks
    
    The return value of vasprintf must be checked. This check is enforced
    with the compiler options used in Debian by request and in Ubuntu by
    default.
    
    Check the return value and abort on error.
    
    Signed-off-by: Bastian Blank <waldi@xxxxxxxxxx>
    Acked-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/tests/mce-test/tools/xen-mceinj.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/tests/mce-test/tools/xen-mceinj.c 
b/tools/tests/mce-test/tools/xen-mceinj.c
index e3e62f7..21a488b 100644
--- a/tools/tests/mce-test/tools/xen-mceinj.c
+++ b/tools/tests/mce-test/tools/xen-mceinj.c
@@ -92,7 +92,8 @@ static void Lprintf(const char *fmt, ...)
     va_list args;
 
     va_start(args, fmt);
-    vasprintf(&buf, fmt, args);
+    if (vasprintf(&buf, fmt, args) < 0)
+        abort();
     fprintf(LOGFILE, "%s", buf);
     va_end(args);
     free(buf);
@@ -104,7 +105,8 @@ static void err(xc_interface *xc_handle, const char *fmt, 
...)
     va_list args;
 
     va_start(args, fmt);
-    vasprintf(&buf, fmt, args);
+    if (vasprintf(&buf, fmt, args) < 0)
+        abort();
     perror(buf);
     va_end(args);
     free(buf);
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
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®.