* [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup()
@ 2024-08-15 13:52 Peter Maydell
2024-08-15 14:19 ` Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Peter Maydell @ 2024-08-15 13:52 UTC (permalink / raw)
To: qemu-devel; +Cc: Alex Williamson, Cédric Le Goater
The tracepoint trace_vfio_msix_early_setup() uses "int" for the type
of the table_bar argument, but we use this to print a uint32_t.
Coverity warns that this means that we could end up treating it as a
negative number.
We only use this in printing the value in the tracepoint, so
mishandling it as a negative number would be harmless, but it's
better to use the right type in the tracepoint. Use uint64_t to
match how we print the table_offset in the vfio_msix_relo()
tracepoint.
Resolves: Coverity CID 1547690
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
hw/vfio/trace-events | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
index 98bd4dccead..c475c273fd8 100644
--- a/hw/vfio/trace-events
+++ b/hw/vfio/trace-events
@@ -27,7 +27,7 @@ vfio_vga_read(uint64_t addr, int size, uint64_t data) " (0x%"PRIx64", %d) = 0x%"
vfio_pci_read_config(const char *name, int addr, int len, int val) " (%s, @0x%x, len=0x%x) 0x%x"
vfio_pci_write_config(const char *name, int addr, int val, int len) " (%s, @0x%x, 0x%x, len=0x%x)"
vfio_msi_setup(const char *name, int pos) "%s PCI MSI CAP @0x%x"
-vfio_msix_early_setup(const char *name, int pos, int table_bar, int offset, int entries, bool noresize) "%s PCI MSI-X CAP @0x%x, BAR %d, offset 0x%x, entries %d, noresize %d"
+vfio_msix_early_setup(const char *name, int pos, int table_bar, uint64_t offset, int entries, bool noresize) "%s PCI MSI-X CAP @0x%x, BAR %d, offset 0x%"PRIx64", entries %d, noresize %d"
vfio_check_pcie_flr(const char *name) "%s Supports FLR via PCIe cap"
vfio_check_pm_reset(const char *name) "%s Supports PM reset"
vfio_check_af_flr(const char *name) "%s Supports FLR via AF cap"
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup()
2024-08-15 13:52 [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup() Peter Maydell
@ 2024-08-15 14:19 ` Philippe Mathieu-Daudé
2024-08-26 16:35 ` Cédric Le Goater
2024-09-02 5:59 ` Cédric Le Goater
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-08-15 14:19 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Alex Williamson, Cédric Le Goater
On 15/8/24 15:52, Peter Maydell wrote:
> The tracepoint trace_vfio_msix_early_setup() uses "int" for the type
> of the table_bar argument, but we use this to print a uint32_t.
> Coverity warns that this means that we could end up treating it as a
> negative number.
>
> We only use this in printing the value in the tracepoint, so
> mishandling it as a negative number would be harmless, but it's
> better to use the right type in the tracepoint. Use uint64_t to
> match how we print the table_offset in the vfio_msix_relo()
> tracepoint.
>
> Resolves: Coverity CID 1547690
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> hw/vfio/trace-events | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup()
2024-08-15 13:52 [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup() Peter Maydell
2024-08-15 14:19 ` Philippe Mathieu-Daudé
@ 2024-08-26 16:35 ` Cédric Le Goater
2024-09-02 5:59 ` Cédric Le Goater
2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2024-08-26 16:35 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Alex Williamson
On 8/15/24 15:52, Peter Maydell wrote:
> The tracepoint trace_vfio_msix_early_setup() uses "int" for the type
> of the table_bar argument, but we use this to print a uint32_t.
> Coverity warns that this means that we could end up treating it as a
> negative number.
>
> We only use this in printing the value in the tracepoint, so
> mishandling it as a negative number would be harmless, but it's
> better to use the right type in the tracepoint. Use uint64_t to
> match how we print the table_offset in the vfio_msix_relo()
> tracepoint.
>
> Resolves: Coverity CID 1547690
Oh. I missed this issue.
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Cédric Le Goater <clg@redhat.com>
Thanks,
C.
> ---
> hw/vfio/trace-events | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/vfio/trace-events b/hw/vfio/trace-events
> index 98bd4dccead..c475c273fd8 100644
> --- a/hw/vfio/trace-events
> +++ b/hw/vfio/trace-events
> @@ -27,7 +27,7 @@ vfio_vga_read(uint64_t addr, int size, uint64_t data) " (0x%"PRIx64", %d) = 0x%"
> vfio_pci_read_config(const char *name, int addr, int len, int val) " (%s, @0x%x, len=0x%x) 0x%x"
> vfio_pci_write_config(const char *name, int addr, int val, int len) " (%s, @0x%x, 0x%x, len=0x%x)"
> vfio_msi_setup(const char *name, int pos) "%s PCI MSI CAP @0x%x"
> -vfio_msix_early_setup(const char *name, int pos, int table_bar, int offset, int entries, bool noresize) "%s PCI MSI-X CAP @0x%x, BAR %d, offset 0x%x, entries %d, noresize %d"
> +vfio_msix_early_setup(const char *name, int pos, int table_bar, uint64_t offset, int entries, bool noresize) "%s PCI MSI-X CAP @0x%x, BAR %d, offset 0x%"PRIx64", entries %d, noresize %d"
> vfio_check_pcie_flr(const char *name) "%s Supports FLR via PCIe cap"
> vfio_check_pm_reset(const char *name) "%s Supports PM reset"
> vfio_check_af_flr(const char *name) "%s Supports FLR via AF cap"
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup()
2024-08-15 13:52 [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup() Peter Maydell
2024-08-15 14:19 ` Philippe Mathieu-Daudé
2024-08-26 16:35 ` Cédric Le Goater
@ 2024-09-02 5:59 ` Cédric Le Goater
2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2024-09-02 5:59 UTC (permalink / raw)
To: Peter Maydell, qemu-devel; +Cc: Alex Williamson
On 8/15/24 15:52, Peter Maydell wrote:
> The tracepoint trace_vfio_msix_early_setup() uses "int" for the type
> of the table_bar argument, but we use this to print a uint32_t.
> Coverity warns that this means that we could end up treating it as a
> negative number.
>
> We only use this in printing the value in the tracepoint, so
> mishandling it as a negative number would be harmless, but it's
> better to use the right type in the tracepoint. Use uint64_t to
> match how we print the table_offset in the vfio_msix_relo()
> tracepoint.
>
> Resolves: Coverity CID 1547690
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Applied to vfio-next.
Thanks,
C.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2024-09-02 6:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-15 13:52 [PATCH for-9.2] hw/vfio/pci.c: Use correct type in trace_vfio_msix_early_setup() Peter Maydell
2024-08-15 14:19 ` Philippe Mathieu-Daudé
2024-08-26 16:35 ` Cédric Le Goater
2024-09-02 5:59 ` Cédric Le Goater
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).