diff options
Diffstat (limited to 'recipes-extended/xen/files/tools-kdd-mute-spurious-gcc-warning-part1.patch')
| -rw-r--r-- | recipes-extended/xen/files/tools-kdd-mute-spurious-gcc-warning-part1.patch | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/tools-kdd-mute-spurious-gcc-warning-part1.patch b/recipes-extended/xen/files/tools-kdd-mute-spurious-gcc-warning-part1.patch new file mode 100644 index 00000000..f94d22c5 --- /dev/null +++ b/recipes-extended/xen/files/tools-kdd-mute-spurious-gcc-warning-part1.patch | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | From 437e00fea04becc91c1b6bc1c0baa636b067a5cc Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?= | ||
| 3 | <marmarek@invisiblethingslab.com> | ||
| 4 | Date: Thu, 5 Apr 2018 03:50:55 +0200 | ||
| 5 | Subject: [PATCH] tools/kdd: mute spurious gcc warning | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | gcc-8 complains: | ||
| 11 | |||
| 12 | 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>'} [-Werror=array-bounds] | ||
| 13 | memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len); | ||
| 14 | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
| 15 | kdd.c: In function 'kdd_select_callback': | ||
| 16 | kdd.c:642:14: note: 'ctrl' declared here | ||
| 17 | kdd_ctrl ctrl; | ||
| 18 | ^~~~ | ||
| 19 | |||
| 20 | But this is impossible - 'offset' is unsigned and correctly validated | ||
| 21 | few lines before. | ||
| 22 | |||
| 23 | Signed-off-by: Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com> | ||
| 24 | Acked-by: Wei Liu <wei.liu2@citrix.com> | ||
| 25 | Release-Acked-by: Juergen Gross <jgross@suse.com> | ||
| 26 | --- | ||
| 27 | tools/debugger/kdd/kdd.c | 3 +++ | ||
| 28 | 1 file changed, 3 insertions(+) | ||
| 29 | |||
| 30 | diff --git a/tools/debugger/kdd/kdd.c b/tools/debugger/kdd/kdd.c | ||
| 31 | index 1bd5dd5..61d769e 100644 | ||
| 32 | --- a/tools/debugger/kdd/kdd.c | ||
| 33 | +++ b/tools/debugger/kdd/kdd.c | ||
| 34 | @@ -695,7 +695,10 @@ static void kdd_handle_read_ctrl(kdd_state *s) | ||
| 35 | KDD_LOG(s, "Request outside of known control space\n"); | ||
| 36 | len = 0; | ||
| 37 | } else { | ||
| 38 | +#pragma GCC diagnostic push | ||
| 39 | +#pragma GCC diagnostic ignored "-Warray-bounds" | ||
| 40 | memcpy(buf, ((uint8_t *)&ctrl.c32) + offset, len); | ||
| 41 | +#pragma GCC diagnostic pop | ||
| 42 | } | ||
| 43 | } | ||
| 44 | |||
| 45 | -- | ||
| 46 | 2.7.4 | ||
| 47 | |||
