-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
0618-tools-kdd-mute-spurious-gcc-warning.patch
45 lines (38 loc) · 1.55 KB
/
0618-tools-kdd-mute-spurious-gcc-warning.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
From 7ec12946362cb0fd6a58c3f45464e847b3cd422d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Marczykowski-G=C3=B3recki?=
Date: Thu, 5 Apr 2018 01:06:12 +0200
Subject: [PATCH] tools/kdd: mute spurious gcc warning
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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>'} [-Werror=array-bounds]
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 <[email protected]>
---
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 320c623edabe..c42a19989ab9 100644
--- a/tools/debugger/kdd/kdd.c
+++ b/tools/debugger/kdd/kdd.c
@@ -1030,7 +1030,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
}
}
--
2.44.0