kdd: stop using [0] arrays to access packet contents

GCC 10 is unhappy about this, and we already use 64k buffers
in the only places where packets are allocated, so move the
64k size into the packet definition.

Reported-by: Olaf Hering <olaf@aepfle.de>
Signed-off-by: Tim Deegan <tim@xen.org>
Acked-by: Wei Liu <wl@xen.org>
Release-acked-by: Paul Durrant <paul@xen.org>
(cherry picked from commit 3471cafbdd)
This commit is contained in:
Tim Deegan authored and Ian Jackson committed 2020-11-09 17:58:19 +00:00
1 parent 0e6975b980
commit eaafa72cf3
2 files changed
+3 -4

No files matched your search

+2 -2
View File
@@ -67,11 +67,11 @@ typedef struct {
/* State of the debugger stub */
typedef struct {
union {
uint8_t txb[sizeof (kdd_hdr) + 65536]; /* Marshalling area for tx */
uint8_t txb[sizeof (kdd_hdr)]; /* Marshalling area for tx */
kdd_pkt txp; /* Also readable as a packet structure */
};
union {
uint8_t rxb[sizeof (kdd_hdr) + 65536]; /* Marshalling area for rx */
uint8_t rxb[sizeof (kdd_hdr)]; /* Marshalling area for rx */
kdd_pkt rxp; /* Also readable as a packet structure */
};
unsigned int cur; /* Offset into rx where we'll put the next byte */
+1 -2
View File
@@ -68,7 +68,6 @@ typedef struct {
uint16_t len; /* Payload length, excl. header and trailing byte */
uint32_t id; /* Echoed in responses */
uint32_t sum; /* Unsigned sum of all payload bytes */
uint8_t payload[0];
} PACKED kdd_hdr;
#define KDD_PKT_CMD 0x0002 /* Debugger commands (and replies to them) */
@@ -323,7 +322,7 @@ typedef struct {
kdd_msg msg;
kdd_reg reg;
kdd_stc stc;
uint8_t payload[0];
uint8_t payload[65536];
};
} PACKED kdd_pkt;
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.