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

[xen staging-4.10] tools/ocaml/libs/xc fix gcc-8 format-truncation warning



commit 934d6e1a77947662504cf4d5e36c9520e03aa731
Author:     John Thomson <git@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Tue May 15 11:48:43 2018 +1000
Commit:     Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
CommitDate: Wed Jun 10 11:57:16 2020 +0100

    tools/ocaml/libs/xc fix gcc-8 format-truncation warning
    
     CC       xenctrl_stubs.o
    xenctrl_stubs.c: In function 'failwith_xc':
    xenctrl_stubs.c:65:17: error: 'snprintf' output may be truncated before the 
last format character [-Werror=format-truncation=]
          "%d: %s: %s", error->code,
                     ^
    xenctrl_stubs.c:64:4: note: 'snprintf' output 6 or more bytes (assuming 
1029) into a destination of size 1028
        snprintf(error_str, sizeof(error_str),
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          "%d: %s: %s", error->code,
          ~~~~~~~~~~~~~~~~~~~~~~~~~~
          xc_error_code_to_desc(error->code),
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          error->message);
          ~~~~~~~~~~~~~~~
    cc1: all warnings being treated as errors
    make[8]: *** 
[/build/xen-git/src/xen/tools/ocaml/libs/xc/../../Makefile.rules:37: 
xenctrl_stubs.o] Error 1
    m
    
    Signed-off-by: John Thomson <git@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
    Release-acked-by: Juergen Gross <jgross@xxxxxxxx>
    (cherry picked from commit 2adc90908fbb1e614c477e29f2d45eda94570795)
---
 tools/ocaml/libs/xc/xenctrl_stubs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/ocaml/libs/xc/xenctrl_stubs.c 
b/tools/ocaml/libs/xc/xenctrl_stubs.c
index dd6000caa3..c486e69086 100644
--- a/tools/ocaml/libs/xc/xenctrl_stubs.c
+++ b/tools/ocaml/libs/xc/xenctrl_stubs.c
@@ -54,7 +54,7 @@
 
 static void Noreturn failwith_xc(xc_interface *xch)
 {
-       char error_str[1028];
+       char error_str[XC_MAX_ERROR_MSG_LEN + 6];
        if (xch) {
                const xc_error *error = xc_get_last_error(xch);
                if (error->code == XC_ERROR_NONE)
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.10



 


Rackspace

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