qemu-e2k/hw/rdma
Peter Maydell 4ab9a7429b hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port()
In query_port() we pass the address of a local pvrdma_port_attr
struct to the rdma_query_backend_port() function.  Unfortunately,
rdma_backend_query_port() wants a pointer to a struct ibv_port_attr,
and the two are not the same length.

Coverity spotted this (CID 1507146): pvrdma_port_attr is 48 bytes
long, and ibv_port_attr is 52 bytes, because it has a few extra
fields at the end.

Fortunately, all we do with the attrs struct after the call is to
read a few specific fields out of it which are all at the same
offsets in both structs, so we can simply make the local variable the
correct type.  This also lets us drop the cast (which should have
been a bit of a warning flag that we were doing something wrong
here).

We do however need to add extra casts for the fields of the
struct that are enums: clang will complain about the implicit
cast to a different enum type otherwise.

Cc: qemu-stable@nongnu.org
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2023-10-21 15:00:22 +03:00
..
vmw hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port() 2023-10-21 15:00:22 +03:00
Kconfig hw/rdma: VMW_PVRDMA should depend on VMXNET3_PCI 2023-04-28 08:05:37 +02:00
meson.build meson: Replace softmmu_ss -> system_ss 2023-06-20 10:01:30 +02:00
rdma_backend_defs.h hw/rdma: Replace QList by GQueue 2020-12-19 10:38:43 +01:00
rdma_backend.c hw/rdma: Replace QList by GQueue 2020-12-19 10:38:43 +01:00
rdma_backend.h hw/rdma: Skip data-path mr_id translation 2020-03-21 19:16:38 +02:00
rdma_rm_defs.h hw/rdma: Modify create/destroy QP to support SRQ 2019-05-04 15:55:56 +03:00
rdma_rm.c hw/rdma: Remove unused macros PG_DIR_SZ and PG_TBL_SZ 2023-04-28 08:05:37 +02:00
rdma_rm.h qapi: introduce x-query-rdma QMP command 2021-11-02 15:55:14 +00:00
rdma_utils.c include/hw/pci: Split pci_device.h off pci.h 2023-01-08 01:54:22 -05:00
rdma_utils.h include/hw/pci: Break inclusion loop pci_bridge.h and cxl.h 2023-01-08 01:54:22 -05:00
rdma.c {hmp, hw/pvrdma}: Expose device internals via monitor interface 2019-03-16 15:52:44 +02:00
trace-events hw/dma: Fix format string issues using dma_addr_t 2022-01-18 12:56:29 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00