misc: Remove variable-length arrays on the stack
v2 cover misc: Remove variable-length arrays on the stack
This is a resend of a subset of patches from a series that Philippe sent out last year:
https://patchew.org/QEMU/[email protected]/
Basically I just pulled out the patches which:
(1) trivially applied on a rebase
(2) had got a Reviewed-by: or at least an Acked-by:
since these should be good to just apply immediately (well, as soon as we reopen for 7.2 development).
Given they're a mixed bag, I propose to take these via the target-arm.next tree, unless anybody specifically wishes to grab specific patches via some other route.
I might come back and have another look at the other left-behind patches later, but this gets rid of more than half of the complaints that a -Wvla build reports.
thanks
-- PMM
Philippe Mathieu-Daudé (11):
chardev/baum: Replace magic values by X_MAX / Y_MAX definitions chardev/baum: Use definitions to avoid dynamic stack allocation chardev/baum: Avoid dynamic stack allocation io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1 hw/net/e1000e_core: Use definition to avoid dynamic stack allocation hw/ppc/pnv: Avoid dynamic stack allocation
hw/intc/xics: Avoid dynamic stack allocation hw/i386/multiboot: Avoid dynamic stack allocation hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation ui/curses: Avoid dynamic stack allocation tests/unit/test-vmstate: Avoid dynamic stack allocation
chardev/baum.c | 22 +++++++++++++--------- hw/i386/multiboot.c | 5 ++--- hw/intc/xics.c | 2 +- hw/net/e1000e_core.c | 7 ++++--- hw/ppc/pnv.c | 4 ++-- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_pci_nvlink2.c | 2 +- hw/usb/hcd-ohci.c | 7 ++++--- io/channel-websock.c | 2 +- tests/unit/test-vmstate.c | 7 +++---- ui/curses.c | 2 +- 11 files changed, 36 insertions(+), 32 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/11 chardev/baum: Replace magic values by X_MAX / Y_MAX definitions
From: Philippe Mathieu-Daudé <[email protected]>
Replace '84' magic value by the X_MAX definition, and '1' by Y_MAX.
--- chardev/baum.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
chardev/baum.c +7 -4
@@ -87,6 +87,9 @@#define BUF_SIZE 256 +#define X_MAX 84 +#define Y_MAX 1 +struct BaumChardev {Chardev parent;
@@ -244,11 +247,11 @@ static int baum_deferred_init(BaumChardev *baum)brlapi_perror ("baum: brlapi__getDisplaySize" );return 0 ; } -if (baum->y >1 ) { - baum->y =1 ; +if (baum->y >Y_MAX ) { + baum->y =Y_MAX ; } -if (baum->x >84 ) { - baum->x =84 ; +if (baum->x >X_MAX ) { + baum->x =X_MAX ; } con =qemu_console_lookup_by_index (0 );
Signature · 1 line
2.25.1
Re: [PATCH v2 01/11] chardev/baum: Replace magic values by X_MAX / Y_MAX definitions
Quoted 11 lines · Peter Maydell
From: Philippe Mathieu-Daudé<[email protected]>
Replace '84' magic value by the
X_MAXdefinition, and '1' byY_MAX.Signed-off-by Philippe Mathieu-Daudé<[email protected]>Reviewed-by Marc-André Lureau<[email protected]>Reviewed-by Samuel Thibault<[email protected]>Signed-off-by Peter Maydell<[email protected]>--- chardev/baum.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
r~
PATCH v2 2/11 chardev/baum: Use definitions to avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
We know 'x * y' will be at most 'X_MAX * Y_MAX' (which is not a big value, it is actually 84). Instead of having the compiler use variable-length array, declare an array able to hold the maximum 'x * y'.
--- chardev/baum.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
chardev/baum.c +4 -4
@@ -383,9 +383,9 @@ static int baum_eat_packet(BaumChardev *baum, const uint8_t *buf, int len)switch (req) {case BAUM_REQ_DisplayData: { -uint8_t cells[baum->x * baum->y], c; -uint8_t text[baum->x * baum->y]; -uint8_t zero[baum->x * baum->y]; +uint8_t cells[X_MAX *Y_MAX ], c; +uint8_t text[X_MAX *Y_MAX ]; +uint8_t zero[X_MAX *Y_MAX ];int cursor =BRLAPI_CURSOR_OFF ;int i;
@@ -408,7 +408,7 @@ static int baum_eat_packet(BaumChardev *baum, const uint8_t *buf, int len) }timer_del (baum->cellCount_timer); -memset (zero,0 ,sizeof (zero)); +memset (zero,0 , baum->x * baum->y);brlapi_writeArguments_t wa = { .displayNumber =BRLAPI_DISPLAY_DEFAULT ,
Signature · 1 line
2.25.1
Re: [PATCH v2 02/11] chardev/baum: Use definitions to avoid dynamic stack allocation
Quoted 7 lines · Peter Maydell
From: Philippe Mathieu-Daudé<[email protected]>
We know 'x * y' will be at most '
X_MAX*Y_MAX' (which is not a big value, it is actually 84). Instead of having the compiler use variable-length array, declare an array able to hold the maximum 'x * y'.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>Reviewed-by Marc-André Lureau<[email protected]>Reviewed-by Samuel Thibault<[email protected]>Signed-off-by Peter Maydell<[email protected]>--- chardev/baum.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
r~
PATCH v2 3/11 chardev/baum: Avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
--- chardev/baum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
chardev/baum.c +2 -1
@@ -299,7 +299,8 @@ static void baum_chr_accept_input(struct Chardev *chr)static void baum_write_packet (BaumChardev *baum,const uint8_t *buf,int len) {Chardev *chr =CHARDEV (baum); -uint8_t io_buf[1 +2 * len], *cur = io_buf; + g_autofree uint8_t *io_buf = g_malloc(1 + 2 * len); +uint8_t *cur = io_buf;int room; *cur++ =ESC ;while (len--)
Signature · 1 line
2.25.1
Re: [PATCH v2 03/11] chardev/baum: Avoid dynamic stack allocation
Quoted 5 lines · Peter Maydell
From: Philippe Mathieu-Daudé<[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>Reviewed-by Marc-André Lureau<[email protected]>Reviewed-by Samuel Thibault<[email protected]>Signed-off-by Peter Maydell<[email protected]>--- chardev/baum.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
r~
PATCH v2 4/11 io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
The combined_key[... QIO_CHANNEL_WEBSOCK_GUID_LEN ...] array in qio_channel_websock_handshake_send_res_ok() expands to a call to strlen(QIO_CHANNEL_WEBSOCK_GUID), and the compiler doesn't realize the string is const, so consider combined_key[] being a variable-length array.
To remove the variable-length array, we provide it a hint to the compiler by using sizeof() - 1 instead of strlen().
--- io/channel-websock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
io/channel-websock.c +1 -1
@@ -32,7 +32,7 @@#define QIO_CHANNEL_WEBSOCK_CLIENT_KEY_LEN 24#define QIO_CHANNEL_WEBSOCK_GUID "258EAFA5-E914-47DA-95CA-C5AB0DC85B11" -#define QIO_CHANNEL_WEBSOCK_GUID_LEN strlen(QIO_CHANNEL_WEBSOCK_GUID) +#define QIO_CHANNEL_WEBSOCK_GUID_LEN (sizeof(QIO_CHANNEL_WEBSOCK_GUID) - 1)#define QIO_CHANNEL_WEBSOCK_HEADER_PROTOCOL "sec-websocket-protocol"#define QIO_CHANNEL_WEBSOCK_HEADER_VERSION "sec-websocket-version"
Signature · 1 line
2.25.1
Re: [PATCH v2 04/11] io/channel-websock: Replace strlen(const_str) by sizeof(const_str) - 1
Quoted 11 lines · Peter Maydell
From: Philippe Mathieu-Daudé<[email protected]>
The combined_key[...
QIO_CHANNEL_WEBSOCK_GUID_LEN...] array inqio_channel_websock_handshake_send_res_ok()expands to a call tostrlen(QIO_CHANNEL_WEBSOCK_GUID), and the compiler doesn't realize the string is const, so consider combined_key[] being a variable-length array.To remove the variable-length array, we provide it a hint to the compiler by using
sizeof()- 1 instead ofstrlen().
Quoted 6 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>Reviewed-by Daniel P. Berrangé<[email protected]>Signed-off-by Peter Maydell<[email protected]>--- io/channel-websock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH v2 5/11 hw/net/e1000e_core: Use definition to avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
The compiler isn't clever enough to figure 'min_buf_size' is a constant, so help it by using a definitions instead.
--- hw/net/e1000e_core.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/net/e1000e_core.c +4 -3
@@ -1622,15 +1622,16 @@ e1000e_rx_fix_l4_csum(E1000ECore *core, struct NetRxPkt *pkt) } } +/* Min. octets in an ethernet frame sans FCS */ +#define MIN_BUF_SIZE 60 +ssize_t e1000e_receive_iov (E1000ECore *core,const struct iovec *iov,int iovcnt) {static const int maximum_ethernet_hdr_len = (14 +4 ); -/* Min. octets in an ethernet frame sans FCS */ -static const int min_buf_size =60 ;uint32_t n =0 ; -uint8_t min_buf[min_buf_size]; +uint8_t min_buf[MIN_BUF_SIZE ];struct iovec min_iov;uint8_t *filter_buf;size_t size, orig_size;
Signature · 1 line
2.25.1
PATCH v2 6/11 hw/ppc/pnv: Avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
--- hw/ppc/pnv.c | 4 ++-- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_pci_nvlink2.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
hw/ppc/pnv.c +2 -2
@@ -137,7 +137,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)int smt_threads =CPU_CORE (pc)->nr_threads;CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cs); -uint32_t servers_prop[smt_threads]; + g_autofree uint32_t *servers_prop = g_new(uint32_t, smt_threads);int i;uint32_t segs[] = {cpu_to_be32 (28 ),cpu_to_be32 (40 ),0xffffffff ,0xffffffff };
@@ -240,7 +240,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) servers_prop[i] =cpu_to_be32 (pc->pir + i); }_FDT ((fdt_setprop (fdt, offset,"ibm,ppc-interrupt-server#s" , - servers_prop,sizeof (servers_prop)))); + servers_prop,sizeof (*servers_prop) * smt_threads))); } static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,
hw/ppc/spapr.c +4 -4
@@ -177,8 +177,8 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, int smt_threads) {int i, ret =0 ; -uint32_t servers_prop[smt_threads]; -uint32_t gservers_prop[smt_threads *2 ]; + g_autofree uint32_t *servers_prop = g_new(uint32_t, smt_threads); + g_autofree uint32_t *gservers_prop = g_new(uint32_t, smt_threads * 2);int index =spapr_get_vcpu_id (cpu);if (cpu->compat_pvr) {
@@ -196,12 +196,12 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, gservers_prop[i*2 +1 ] =0 ; } ret =fdt_setprop (fdt, offset,"ibm,ppc-interrupt-server#s" , - servers_prop,sizeof (servers_prop)); + servers_prop,sizeof (*servers_prop) * smt_threads);if (ret <0 ) {return ret; } ret =fdt_setprop (fdt, offset,"ibm,ppc-interrupt-gserver#s" , - gservers_prop,sizeof (gservers_prop)); + gservers_prop,sizeof (*gservers_prop) * smt_threads *2 );return ret; }
hw/ppc/spapr_pci_nvlink2.c +1 -1
@@ -397,7 +397,7 @@ void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int offset,continue ; }if (dev == nvslot->gpdev) { -uint32_t npus[nvslot->linknum]; + g_autofree uint32_t *npus = g_new(uint32_t, nvslot->linknum);for (j =0 ; j < nvslot->linknum; ++j) {PCIDevice *npdev = nvslot->links[j].npdev;
Signature · 1 line
2.25.1
Re: [PATCH v2 06/11] hw/ppc/pnv: Avoid dynamic stack allocation
Quoted 9 lines · Peter Maydell
From: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
Signed-off-by Philippe Mathieu-Daudé <[email protected]>Acked-by David Gibson <[email protected]>Signed-off-by Peter Maydell <[email protected]>Reviewed-by Peter Maydell <[email protected]>
Feel free to take it via target-arm.next.
Thanks,
Daniel
Quoted 71 lines
--- hw/ppc/pnv.c | 4 ++-- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_pci_nvlink2.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)hw/ppc/pnv.c +2
-2@@ -137,7 +137,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt)int smt_threads =CPU_CORE (pc)->nr_threads;CPUPPCState *env = &cpu->env;PowerPCCPUClass *pcc =POWERPC_CPU_GET_CLASS (cs); -uint32_t servers_prop[smt_threads]; + g_autofree uint32_t *servers_prop = g_new(uint32_t, smt_threads);int i;uint32_t segs[] = {cpu_to_be32 (28 ),cpu_to_be32 (40 ),0xffffffff ,0xffffffff };@@ -240,7 +240,7 @@ static void pnv_dt_core(PnvChip *chip, PnvCore *pc, void *fdt) servers_prop[i] =cpu_to_be32 (pc->pir + i); }_FDT ((fdt_setprop (fdt, offset,"ibm,ppc-interrupt-server#s" , - servers_prop,sizeof (servers_prop)))); + servers_prop,sizeof (*servers_prop) * smt_threads))); } static void pnv_dt_icp(PnvChip *chip, void *fdt, uint32_t pir,hw/ppc/spapr.c +4
-4@@ -177,8 +177,8 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, int smt_threads) {int i, ret =0 ; -uint32_t servers_prop[smt_threads]; -uint32_t gservers_prop[smt_threads *2 ]; + g_autofree uint32_t *servers_prop = g_new(uint32_t, smt_threads); + g_autofree uint32_t *gservers_prop = g_new(uint32_t, smt_threads * 2);int index =spapr_get_vcpu_id (cpu);if (cpu->compat_pvr) {@@ -196,12 +196,12 @@ static int spapr_fixup_cpu_smt_dt(void *fdt, int offset, PowerPCCPU *cpu, gservers_prop[i*2 +1 ] =0 ; } ret =fdt_setprop (fdt, offset,"ibm,ppc-interrupt-server#s" , - servers_prop,sizeof (servers_prop)); + servers_prop,sizeof (*servers_prop) * smt_threads);if (ret <0 ) {return ret; } ret =fdt_setprop (fdt, offset,"ibm,ppc-interrupt-gserver#s" , - gservers_prop,sizeof (gservers_prop)); + gservers_prop,sizeof (*gservers_prop) * smt_threads *2 );return ret; }hw/ppc/spapr_pci_nvlink2.c +1
-1@@ -397,7 +397,7 @@ void spapr_phb_nvgpu_populate_pcidev_dt(PCIDevice *dev, void *fdt, int offset,continue ; }if (dev == nvslot->gpdev) { -uint32_t npus[nvslot->linknum]; + g_autofree uint32_t *npus = g_new(uint32_t, nvslot->linknum);for (j =0 ; j < nvslot->linknum; ++j) {PCIDevice *npdev = nvslot->links[j].npdev;
Re: [PATCH v2 06/11] hw/ppc/pnv: Avoid dynamic stack allocation
In reply to Peter MaydellQuoted 9 lines · Peter Maydell
From: Philippe Mathieu-Daudé<[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
Signed-off-by Philippe Mathieu-Daudé<[email protected]>Acked-by David Gibson<[email protected]>Signed-off-by Peter Maydell<[email protected]>Reviewed-by Peter Maydell<[email protected]>
Quoted 5 lines
--- hw/ppc/pnv.c | 4 ++-- hw/ppc/spapr.c | 8 ++++---- hw/ppc/spapr_pci_nvlink2.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)
r~
PATCH v2 7/11 hw/intc/xics: Avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
--- hw/intc/xics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/xics.c +1 -1
@@ -567,8 +567,8 @@ static void ics_reset_irq(ICSIRQState *irq)static void ics_reset (DeviceState *dev) {ICSState *ics =ICS (dev); + g_autofree uint8_t *flags = g_malloc(ics->nr_irqs);int i; -uint8_t flags[ics->nr_irqs];for (i =0 ; i < ics->nr_irqs; i++) { flags[i] = ics->irqs[i].flags;
Signature · 1 line
2.25.1
Re: [PATCH v2 07/11] hw/intc/xics: Avoid dynamic stack allocation
Quoted 5 lines · Peter Maydell
From: Philippe Mathieu-Daudé<[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
Quoted 7 lines
Signed-off-by Philippe Mathieu-Daudé<[email protected]>Acked-by David Gibson<[email protected]>Reviewed-by Greg Kurz<[email protected]>Signed-off-by Peter Maydell<[email protected]>--- hw/intc/xics.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
r~
PATCH v2 8/11 hw/i386/multiboot: Avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack. Replace the snprintf() call by g_strdup_printf().
--- hw/i386/multiboot.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-)
hw/i386/multiboot.c +2 -3
@@ -163,6 +163,7 @@ int load_multiboot(X86MachineState *x86ms,uint8_t *mb_bootinfo_data;uint32_t cmdline_len;GList *mods =NULL ; + g_autofree char *kcmdline = NULL;/* Ok, let's see if it is a multiboot image. The header is 12x32bit long, so the latest entry may be 8192 - 48. */
@@ -362,9 +363,7 @@ int load_multiboot(X86MachineState *x86ms, }/* Commandline support */ -char kcmdline[strlen (kernel_filename) +strlen (kernel_cmdline) +2 ]; -snprintf (kcmdline,sizeof (kcmdline),"%s %s" , - kernel_filename, kernel_cmdline); + kcmdline =g_strdup_printf ("%s %s" , kernel_filename, kernel_cmdline);stl_p (bootinfo +MBI_CMDLINE ,mb_add_cmdline (&mbs, kcmdline));stl_p (bootinfo +MBI_BOOTLOADER ,mb_add_bootloader (&mbs, bootloader_name));
Signature · 1 line
2.25.1
PATCH v2 9/11 hw/usb/hcd-ohci: Use definition to avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
The compiler isn't clever enough to figure 'width' is a constant, so help it by using a definitions instead.
--- hw/usb/hcd-ohci.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-)
hw/usb/hcd-ohci.c +4 -3
@@ -805,13 +805,14 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed)return 1 ; } +#define HEX_CHAR_PER_LINE 16 +static void ohci_td_pkt (const char *msg,const uint8_t *buf,size_t len) {bool print16;bool printall; -const int width =16 ;int i; -char tmp[3 * width +1 ]; +char tmp[3 *HEX_CHAR_PER_LINE +1 ];char *p = tmp; print16 = !!trace_event_get_state_backends (TRACE_USB_OHCI_TD_PKT_SHORT );
@@ -822,7 +823,7 @@ static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len) }for (i =0 ; ; i++) { -if (i && (!(i % width) || (i == len))) { +if (i && (!(i %HEX_CHAR_PER_LINE ) || (i == len))) {if (!printall) {trace_usb_ohci_td_pkt_short (msg, tmp);break ;
Signature · 1 line
2.25.1
PATCH v2 10/11 ui/curses: Avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
--- ui/curses.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
ui/curses.c +1 -1
@@ -69,7 +69,7 @@ static void curses_update(DisplayChangeListener *dcl, int x, int y, int w, int h) { console_ch_t *line; -cchar_t curses_line[width]; + g_autofree cchar_t *curses_line = g_new(cchar_t, width);wchar_t wch[CCHARW_MAX ];attr_t attrs;short colors;
Signature · 1 line
2.25.1
PATCH v2 11/11 tests/unit/test-vmstate: Avoid dynamic stack allocation
In reply to Peter MaydellFrom: Philippe Mathieu-Daudé <[email protected]>
Use autofree heap allocation instead of variable-length array on the stack.
--- tests/unit/test-vmstate.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
tests/unit/test-vmstate.c +3 -4
@@ -87,17 +87,16 @@ static void save_buffer(const uint8_t *buf, size_t buf_size)static void compare_vmstate (const uint8_t *wire,size_t size) {QEMUFile *f =open_test_file (false); -uint8_t result[size]; + g_autofree uint8_t *result = g_malloc(size);/* read back as binary */ - g_assert_cmpint(qemu_get_buffer(f, result, sizeof(result)), ==, -sizeof (result)); + g_assert_cmpint(qemu_get_buffer(f, result, size), ==, size);g_assert (!qemu_file_get_error (f));/* Compare that what is on the file is the same that what we expected to be there */ -SUCCESS (memcmp (result, wire,sizeof (result))); +SUCCESS (memcmp (result, wire, size));/* Must reach EOF */ qemu_get_byte (f);
Signature · 1 line
2.25.1
Quoted 15 lines · Peter Maydell
This is a resend of a subset of patches from a series that Philippe sent out last year:
https://patchew.org/QEMU/[email protected]/Basically I just pulled out the patches which:
(1) trivially applied on a rebase
(2) had got a Reviewed-by: or at least an Acked-by:since these should be good to just apply immediately (well, as soon as we reopen for 7.2 development).
Given they're a mixed bag, I propose to take these via the target-arm.next tree, unless anybody specifically wishes to grab specific patches via some other route.
Quoted 6 lines
I might come back and have another look at the other left-behind patches later, but this gets rid of more than half of the complaints that a -Wvla build reports.
thanks
-- PMM
Thank you Peter!