From f488becdbb12c6001a2524d049371196a05f5256 Mon Sep 17 00:00:00 2001 From: Miroslav Rezanina Date: Fri, 15 Jan 2021 09:27:40 +0100 Subject: Revert "GCC 11 warnings hacks" This reverts commit 6e9564986a00456c6748cf888d9ba9f7f0db01bf. Hacks solved upstream. Going to import upstream solutions. --- 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, 17 insertions(+), 19 deletions(-) diff --git a/hw/scsi/scsi-disk.c b/hw/scsi/scsi-disk.c index 8ce77777d3..90841ad791 100644 --- a/hw/scsi/scsi-disk.c +++ b/hw/scsi/scsi-disk.c @@ -2578,15 +2578,14 @@ 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; - 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); + line_buffer = g_malloc(len * 5 + 1); - g_free(line_buffer); + 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); + + 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 041ac4865a..1e0821c5f8 100644 --- a/net/eth.c +++ b/net/eth.c @@ -405,8 +405,6 @@ _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) && @@ -426,7 +424,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 ab1ca6b1bf..1839cc6648 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])-1); + sizeof(sysib.ext_names[0])); } else { strcpy((char *)sysib.ext_names[0], "KVMguest"); } diff --git a/target/s390x/misc_helper.c b/target/s390x/misc_helper.c index adaf4145e6..58dbc023eb 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])-1); + sizeof(sysib.sysib_322.ext_names[0])); } 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 fe6bdbf721..26f71cb599 100644 --- a/tcg/aarch64/tcg-target.c.inc +++ b/tcg/aarch64/tcg-target.c.inc @@ -1852,7 +1852,8 @@ 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, const int *const_args) + const TCGArg args[TCG_MAX_OP_ARGS], + const int const_args[TCG_MAX_OP_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 bc64b50e66..3f866a35c6 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] = {0}; + uint8_t buf[512]; 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] = {0}; + uint8_t buf[512]; 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] = {0}; + uint8_t buf[512]; 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] = {0}; + uint8_t buf[512]; 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] = {0}; + uint8_t buf[512]; 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] = {0}; + uint8_t buf[512]; int ret; /* Error: Driver does not support snapshots */ -- 2.18.4