From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: Yuval Shaia <yuval.shaia.ml@gmail.com>,
Marcel Apfelbaum <marcel.apfelbaum@gmail.com>
Subject: Re: [PATCH for-8.1] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port()
Date: Tue, 12 Sep 2023 15:08:44 +0100 [thread overview]
Message-ID: <CAFEAcA8YxuRGp5sfXauWfiTsOE7H6hkbRKp1Pp0ampxsct5hQg@mail.gmail.com> (raw)
In-Reply-To: <CAFEAcA-DXnmtfKYrOjrSRp=rjdV-Owqm+b0=oB6y-=H=VP9fLg@mail.gmail.com>
Ping^2 for review/pickup by the rdma folks, please?
thanks
-- PMM
On Tue, 29 Aug 2023 at 16:49, Peter Maydell <peter.maydell@linaro.org> wrote:
>
> On Tue, 25 Jul 2023 at 12:36, Peter Maydell <peter.maydell@linaro.org> wrote:
> >
> > 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>
> > ---
> > I don't know anything about the rdma code so this fix is based
> > purely on looking at the code, and is untested beyond just
> > make check/make check-avocado.
> > ---
> > hw/rdma/vmw/pvrdma_cmd.c | 5 ++---
> > 1 file changed, 2 insertions(+), 3 deletions(-)
> >
> > diff --git a/hw/rdma/vmw/pvrdma_cmd.c b/hw/rdma/vmw/pvrdma_cmd.c
> > index c6ed0259821..d31c1875938 100644
> > --- a/hw/rdma/vmw/pvrdma_cmd.c
> > +++ b/hw/rdma/vmw/pvrdma_cmd.c
> > @@ -129,14 +129,13 @@ static int query_port(PVRDMADev *dev, union pvrdma_cmd_req *req,
> > {
> > struct pvrdma_cmd_query_port *cmd = &req->query_port;
> > struct pvrdma_cmd_query_port_resp *resp = &rsp->query_port_resp;
> > - struct pvrdma_port_attr attrs = {};
> > + struct ibv_port_attr attrs = {};
> >
> > if (cmd->port_num > MAX_PORTS) {
> > return -EINVAL;
> > }
> >
> > - if (rdma_backend_query_port(&dev->backend_dev,
> > - (struct ibv_port_attr *)&attrs)) {
> > + if (rdma_backend_query_port(&dev->backend_dev, &attrs)) {
> > return -ENOMEM;
> > }
>
> Ping for review/testing by the rdma folks, please ?
> Whose tree should this patch go through?
next prev parent reply other threads:[~2023-09-12 14:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-25 11:36 [PATCH for-8.1] hw/rdma/vmw/pvrdma_cmd: Use correct struct in query_port() Peter Maydell
2023-07-25 13:08 ` Philippe Mathieu-Daudé
2023-08-29 15:49 ` Peter Maydell
2023-09-12 14:08 ` Peter Maydell [this message]
2023-09-22 15:05 ` Thomas Huth
2023-09-23 15:15 ` Michael Tokarev
2023-10-11 5:21 ` Thomas Huth
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=CAFEAcA8YxuRGp5sfXauWfiTsOE7H6hkbRKp1Pp0ampxsct5hQg@mail.gmail.com \
--to=peter.maydell@linaro.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=yuval.shaia.ml@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).