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

[Xen-changelog] [xen master] tools/kdd: mute spurious gcc warning

commit 437e00fea04becc91c1b6bc1c0baa636b067a5cc
Author:     Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
AuthorDate: Thu Apr 5 03:50:55 2018 +0200
Commit:     Wei Liu <wei.liu2@xxxxxxxxxx>
CommitDate: Fri Apr 6 09:06:19 2018 +0100

    tools/kdd: mute spurious gcc warning
    gcc-8 complains:
        kdd.c:698:13: error: 'memcpy' offset [-204, -717] is out of the bounds 
[0, 216] of object 'ctrl' with type 'kdd_ctrl' {aka 'union <anonymous>'} 
                     memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len);
        kdd.c: In function 'kdd_select_callback':
        kdd.c:642:14: note: 'ctrl' declared here
             kdd_ctrl ctrl;
    But this is impossible - 'offset' is unsigned and correctly validated
    few lines before.
    Signed-off-by: Marek Marczykowski-Górecki <marmarek@xxxxxxxxxxxxxxxxxxxxxx>
    Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx>
    Release-Acked-by: Juergen Gross <jgross@xxxxxxxx>
 tools/debugger/kdd/kdd.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c
index 1bd5dd5992..61d769ece9 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -695,7 +695,10 @@ static void kdd_handle_read_ctrl(kdd_state *s)
             KDD_LOG(s, "Request outside of known control space\n");
             len = 0;
         } else {
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Warray-bounds"
             memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len);
+#pragma GCC diagnostic pop
generated by git-patchbot for /home/xen/git/xen.git#master

Xen-changelog mailing list



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