qemu-e2k/hw/char
Zhao Liu 0a81424def hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend()
As the comment in qapi/error, passing @errp to error_prepend() requires
ERRP_GUARD():

* = Why, when and how to use ERRP_GUARD() =
*
* Without ERRP_GUARD(), use of the @errp parameter is restricted:
...
* - It should not be passed to error_prepend(), error_vprepend() or
*   error_append_hint(), because that doesn't work with &error_fatal.
* ERRP_GUARD() lifts these restrictions.
*
* To use ERRP_GUARD(), add it right at the beginning of the function.
* @errp can then be used without worrying about the argument being
* NULL or &error_fatal.

ERRP_GUARD() could avoid the case when @errp is the pointer of
error_fatal, the user can't see this additional information, because
exit() happens in error_setg earlier than information is added [1].

The xen_console_connect() passes @errp to error_prepend() without
ERRP_GUARD().

There're 2 places will call xen_console_connect():
 - xen_console_realize(): the @errp is from DeviceClass.realize()'s
			  parameter.
 - xen_console_frontend_changed(): the @errp points its caller's
                                   @local_err.

To avoid the issue like [1] said, add missing ERRP_GUARD() at the
beginning of xen_console_connect().

[1]: Issue description in the commit message of commit ae7c80a7bd
     ("error: New macro ERRP_GUARD()").

Cc: Stefano Stabellini <sstabellini@kernel.org>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Paul Durrant <paul@xen.org>
Cc: "Marc-André Lureau" <marcandre.lureau@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Acked-by: Anthony PERARD <anthony.perard@citrix.com>
Message-ID: <20240228163723.1775791-15-zhao1.liu@linux.intel.com>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
2024-03-09 18:51:45 +01:00
..
avr_usart.c
bcm2835_aux.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
cadence_uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
cmsdk-apb-uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
debugcon.c
digic-uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
escc.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
etraxfs_ser.c
exynos4210_uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
goldfish_tty.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
grlib_apbuart.c hw/sparc/grlib: split out the headers for each peripherals 2024-02-15 16:58:46 +01:00
ibex_uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
imx_serial.c hw/char/imx_serial: Implement receive FIFO and ageing timer 2024-01-26 11:34:21 +00:00
ipoctal232.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
Kconfig
mcf_uart.c hw/char/mcf_uart: Have mcf_uart_create() return DeviceState 2023-11-01 07:31:05 +01:00
mchp_pfsoc_mmuart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
nrf51_uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
omap_uart.c hw/arm/omap: Remove unused omap_uart_attach() 2023-06-05 07:43:23 +01:00
parallel-isa.c hw/char/parallel-isa: Implement relocation and enabling/disabling for TYPE_ISA_PARALLEL 2024-02-14 06:09:32 -05:00
parallel.c hw/char/parallel: Move portio_list from ParallelState to ISAParallelState 2024-02-14 06:09:32 -05:00
pl011.c hw/char/pl011: Add support for loopback 2024-03-05 13:22:55 +00:00
renesas_sci.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
riscv_htif.c hw/char: riscv_htif: replace exit calls with proper shutdown 2023-10-12 12:35:36 +10:00
sclpconsole-lm.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
sclpconsole.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
serial-isa.c hw/char/serial-isa: Implement relocation and enabling/disabling for TYPE_ISA_SERIAL 2024-02-14 06:09:32 -05:00
serial-pci-multi.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
serial-pci.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
serial.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
sh_serial.c
shakti_uart.c
sifive_uart.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
spapr_vty.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
stm32f2xx_usart.c hw/char/stm32f2xx_usart: Update IRQ when DR is written 2023-11-02 13:36:45 +00:00
terminal3270.c
trace-events hw/xen: update Xen console to XenDevice model 2023-11-07 08:54:20 +00:00
trace.h
virtio-console.c hw/char: Have FEWatchFunc handlers return G_SOURCE_CONTINUE/REMOVE 2023-08-31 19:47:43 +02:00
virtio-serial-bus.c hw/char: Constify VMState 2023-12-29 11:17:30 +11:00
xen_console.c hw/char/xen_console: Fix missing ERRP_GUARD() for error_prepend() 2024-03-09 18:51:45 +01:00
xilinx_uartlite.c