From: Thomas Huth <thuth@redhat.com>
To: Stefan Hajnoczi <stefanha@gmail.com>, Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-devel@nongnu.org, "Peter Maydell" <peter.maydell@linaro.org>,
qemu-trivial@nongnu.org, qemu-stable@nongnu.org,
"Philippe Mathieu-Daudé" <philmd@linaro.org>
Subject: Re: [PULL 02/13] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port()
Date: Wed, 11 Oct 2023 18:29:23 +0200 [thread overview]
Message-ID: <3f804d1f-cb72-452c-83b2-80f57331d170@redhat.com> (raw)
In-Reply-To: <CAJSP0QVkuu4EbW5gKmrN6Gotnhw1LG+ka=6vjuftPXBrKY+R3g@mail.gmail.com>
On 11/10/2023 17.38, Stefan Hajnoczi wrote:
> On Wed, 11 Oct 2023 at 07:23, Michael Tokarev <mjt@tls.msk.ru> wrote:
>>
>> From: Peter Maydell <peter.maydell@linaro.org>
>>
>> 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).
>>
>> Cc: qemu-stable@nongnu.org
>> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
>> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
>> Reviewed-by: Thomas Huth <thuth@redhat.com>
>> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
>> ---
>> hw/rdma/vmw/pvrdma_cmd.c | 5 ++---
>> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> The following CI failure has occurred:
>
> ../hw/rdma/vmw/pvrdma_cmd.c:144:59: error: implicit conversion from
> enumeration type 'enum ibv_port_state' to different enumeration type
> 'enum pvrdma_port_state' [-Werror,-Wenum-conversion]
> resp->attrs.state = dev->func0->device_active ? attrs.state :
> ~ ~~~~~~^~~~~
> ../hw/rdma/vmw/pvrdma_cmd.c:146:33: error: implicit conversion from
> enumeration type 'enum ibv_mtu' to different enumeration type 'enum
> pvrdma_mtu' [-Werror,-Wenum-conversion]
> resp->attrs.max_mtu = attrs.max_mtu;
> ~ ~~~~~~^~~~~~~
> ../hw/rdma/vmw/pvrdma_cmd.c:147:36: error: implicit conversion from
> enumeration type 'enum ibv_mtu' to different enumeration type 'enum
> pvrdma_mtu' [-Werror,-Wenum-conversion]
> resp->attrs.active_mtu = attrs.active_mtu;
> ~ ~~~~~~^~~~~~~~~~
>
> https://gitlab.com/qemu-project/qemu/-/jobs/5270666420
>
> Please take a look.
That pvrdma patch unfortunately does not work with Clang, see also:
https://lore.kernel.org/qemu-devel/781330fc-85b3-4ef1-8f07-1cc5fc5e4ad2@redhat.com/T/#t
Thomas
next prev parent reply other threads:[~2023-10-11 16:30 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-11 11:20 [PULL 00/13] Trivial patches for 2023-10-11 Michael Tokarev
2023-10-11 11:20 ` [PULL 01/13] Update AMD memory encryption document links Michael Tokarev
2023-10-11 11:20 ` [PULL 02/13] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port() Michael Tokarev
2023-10-11 15:38 ` Stefan Hajnoczi
2023-10-11 16:29 ` Thomas Huth [this message]
2023-10-19 14:41 ` Peter Maydell
2023-10-11 11:20 ` [PULL 03/13] Fix compilation when UFFDIO_REGISTER is not set Michael Tokarev
2023-10-11 11:20 ` [PULL 04/13] MAINTAINERS: Add g364fb and ds1225y to the Jazz section Michael Tokarev
2023-10-11 11:20 ` [PULL 05/13] MAINTAINERS: Add unowned RISC-V related files to the right sections Michael Tokarev
2023-10-11 11:20 ` [PULL 06/13] MAINTAINERS: Add include folder to the hw/char/ section Michael Tokarev
2023-10-11 11:20 ` [PULL 07/13] MAINTAINERS: Add the CI-related doc files to the CI section Michael Tokarev
2023-10-11 11:20 ` [PULL 08/13] MAINTAINERS: add standard-headers to Hosts/LINUX Michael Tokarev
2023-10-11 11:20 ` [PULL 09/13] MAINTAINERS: Add section for overall sensors Michael Tokarev
2023-10-11 11:20 ` [PULL 10/13] MAINTAINERS: Add some unowned files to the SBSA-REF section Michael Tokarev
2023-10-11 11:20 ` [PULL 11/13] roms: use PYTHON to invoke python Michael Tokarev
2023-10-11 11:20 ` [PULL 12/13] scripts/xml-preprocess: Make sure this script is invoked via the right Python Michael Tokarev
2023-10-11 11:20 ` [PULL 13/13] cpus: Remove unused smp_cores/smp_threads declarations Michael Tokarev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3f804d1f-cb72-452c-83b2-80f57331d170@redhat.com \
--to=thuth@redhat.com \
--cc=mjt@tls.msk.ru \
--cc=peter.maydell@linaro.org \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=qemu-trivial@nongnu.org \
--cc=stefanha@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).