164 lines
5.4 KiB
Diff
164 lines
5.4 KiB
Diff
From 6e9564986a00456c6748cf888d9ba9f7f0db01bf Mon Sep 17 00:00:00 2001
|
|
From: Miroslav Rezanina <mrezanin@redhat.com>
|
|
Date: Mon, 4 Jan 2021 07:47:03 +0100
|
|
Subject: GCC 11 warnings hacks
|
|
|
|
---
|
|
hw/scsi/scsi-disk.c | 13 +++++++------
|
|
net/eth.c | 4 +++-
|
|
target/s390x/kvm.c | 2 +-
|
|
target/s390x/misc_helper.c | 2 +-
|
|
tcg/aarch64/tcg-target.c.inc | 3 +--
|
|
tests/test-block-iothread.c | 12 ++++++------
|
|
6 files changed, 19 insertions(+), 17 deletions(-)
|
|
|
|
diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c
|
|
index 90841ad791..8ce77777d3 100644
|
|
--- a/hw/scsi/scsi-disk.c
|
|
+++ b/hw/scsi/scsi-disk.c
|
|
@@ -2578,14 +2578,15 @@ static void scsi_disk_new_request_dump(uint32_t lun, uint32_t tag, uint8_t *buf)
|
|
int len = scsi_cdb_length(buf);
|
|
char *line_buffer, *p;
|
|
|
|
- line_buffer = g_malloc(len * 5 + 1);
|
|
+ if (len > 0) {
|
|
+ line_buffer = g_malloc(len * 5 + 1);
|
|
+ for (i = 0, p = line_buffer; i < len; i++) {
|
|
+ p += sprintf(p, " 0x%02x", buf[i]);
|
|
+ }
|
|
+ trace_scsi_disk_new_request(lun, tag, line_buffer);
|
|
|
|
- for (i = 0, p = line_buffer; i < len; i++) {
|
|
- p += sprintf(p, " 0x%02x", buf[i]);
|
|
+ g_free(line_buffer);
|
|
}
|
|
- trace_scsi_disk_new_request(lun, tag, line_buffer);
|
|
-
|
|
- g_free(line_buffer);
|
|
}
|
|
|
|
static SCSIRequest *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun,
|
|
diff --git a/net/eth.c b/net/eth.c
|
|
index 1e0821c5f8..041ac4865a 100644
|
|
--- a/net/eth.c
|
|
+++ b/net/eth.c
|
|
@@ -405,6 +405,8 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
|
|
struct ip6_ext_hdr *ext_hdr,
|
|
struct in6_address *dst_addr)
|
|
{
|
|
+#pragma GCC diagnostic push
|
|
+#pragma GCC diagnostic ignored "-Warray-bounds"
|
|
struct ip6_ext_hdr_routing *rthdr = (struct ip6_ext_hdr_routing *) ext_hdr;
|
|
|
|
if ((rthdr->rtype == 2) &&
|
|
@@ -424,7 +426,7 @@ _eth_get_rss_ex_dst_addr(const struct iovec *pkt, int pkt_frags,
|
|
|
|
return bytes_read == sizeof(*dst_addr);
|
|
}
|
|
-
|
|
+#pragma GCC diagnostic pop
|
|
return false;
|
|
}
|
|
|
|
diff --git a/target/s390x/kvm.c b/target/s390x/kvm.c
|
|
index 1839cc6648..ab1ca6b1bf 100644
|
|
--- a/target/s390x/kvm.c
|
|
+++ b/target/s390x/kvm.c
|
|
@@ -1918,7 +1918,7 @@ static void insert_stsi_3_2_2(S390CPU *cpu, __u64 addr, uint8_t ar)
|
|
*/
|
|
if (qemu_name) {
|
|
strncpy((char *)sysib.ext_names[0], qemu_name,
|
|
- sizeof(sysib.ext_names[0]));
|
|
+ sizeof(sysib.ext_names[0])-1);
|
|
} else {
|
|
strcpy((char *)sysib.ext_names[0], "KVMguest");
|
|
}
|
|
diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c
|
|
index 58dbc023eb..adaf4145e6 100644
|
|
--- a/target/s390x/misc_helper.c
|
|
+++ b/target/s390x/misc_helper.c
|
|
@@ -370,7 +370,7 @@ uint32_t HELPER(stsi)(CPUS390XState *env, uint64_t a0, uint64_t r0, uint64_t r1)
|
|
MIN(sizeof(sysib.sysib_322.vm[0].name),
|
|
strlen(qemu_name)));
|
|
strncpy((char *)sysib.sysib_322.ext_names[0], qemu_name,
|
|
- sizeof(sysib.sysib_322.ext_names[0]));
|
|
+ sizeof(sysib.sysib_322.ext_names[0])-1);
|
|
} else {
|
|
ebcdic_put(sysib.sysib_322.vm[0].name, "TCGguest", 8);
|
|
strcpy((char *)sysib.sysib_322.ext_names[0], "TCGguest");
|
|
diff --git a/tcg/aarch64/tcg-target.c.inc b/tcg/aarch64/tcg-target.c.inc
|
|
index 26f71cb599..fe6bdbf721 100644
|
|
--- a/tcg/aarch64/tcg-target.c.inc
|
|
+++ b/tcg/aarch64/tcg-target.c.inc
|
|
@@ -1852,8 +1852,7 @@ static void tcg_out_qemu_st(TCGContext *s, TCGReg data_reg, TCGReg addr_reg,
|
|
static tcg_insn_unit *tb_ret_addr;
|
|
|
|
static void tcg_out_op(TCGContext *s, TCGOpcode opc,
|
|
- const TCGArg args[TCG_MAX_OP_ARGS],
|
|
- const int const_args[TCG_MAX_OP_ARGS])
|
|
+ const TCGArg *args, const int *const_args)
|
|
{
|
|
/* 99% of the time, we can signal the use of extension registers
|
|
by looking to see if the opcode handles 64-bit data. */
|
|
diff --git a/tests/test-block-iothread.c b/tests/test-block-iothread.c
|
|
index 3f866a35c6..bc64b50e66 100644
|
|
--- a/tests/test-block-iothread.c
|
|
+++ b/tests/test-block-iothread.c
|
|
@@ -75,7 +75,7 @@ static BlockDriver bdrv_test = {
|
|
|
|
static void test_sync_op_pread(BdrvChild *c)
|
|
{
|
|
- uint8_t buf[512];
|
|
+ uint8_t buf[512] = {0};
|
|
int ret;
|
|
|
|
/* Success */
|
|
@@ -89,7 +89,7 @@ static void test_sync_op_pread(BdrvChild *c)
|
|
|
|
static void test_sync_op_pwrite(BdrvChild *c)
|
|
{
|
|
- uint8_t buf[512];
|
|
+ uint8_t buf[512] = {0};
|
|
int ret;
|
|
|
|
/* Success */
|
|
@@ -103,7 +103,7 @@ static void test_sync_op_pwrite(BdrvChild *c)
|
|
|
|
static void test_sync_op_blk_pread(BlockBackend *blk)
|
|
{
|
|
- uint8_t buf[512];
|
|
+ uint8_t buf[512] = {0};
|
|
int ret;
|
|
|
|
/* Success */
|
|
@@ -117,7 +117,7 @@ static void test_sync_op_blk_pread(BlockBackend *blk)
|
|
|
|
static void test_sync_op_blk_pwrite(BlockBackend *blk)
|
|
{
|
|
- uint8_t buf[512];
|
|
+ uint8_t buf[512] = {0};
|
|
int ret;
|
|
|
|
/* Success */
|
|
@@ -131,7 +131,7 @@ static void test_sync_op_blk_pwrite(BlockBackend *blk)
|
|
|
|
static void test_sync_op_load_vmstate(BdrvChild *c)
|
|
{
|
|
- uint8_t buf[512];
|
|
+ uint8_t buf[512] = {0};
|
|
int ret;
|
|
|
|
/* Error: Driver does not support snapshots */
|
|
@@ -141,7 +141,7 @@ static void test_sync_op_load_vmstate(BdrvChild *c)
|
|
|
|
static void test_sync_op_save_vmstate(BdrvChild *c)
|
|
{
|
|
- uint8_t buf[512];
|
|
+ uint8_t buf[512] = {0};
|
|
int ret;
|
|
|
|
/* Error: Driver does not support snapshots */
|
|
--
|
|
2.18.4
|
|
|