From: "Cédric Le Goater" <clg@redhat.com>
To: YangHang Liu <yanghliu@redhat.com>
Cc: "Akihiko Odaki" <akihiko.odaki@daynix.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel.apfelbaum@gmail.com>,
qemu-devel@nongnu.org, "Alex Bennée" <alex.bennee@linaro.org>
Subject: Re: [PATCH] pcie_sriov: Remove g_new assertion
Date: Thu, 30 Nov 2023 16:37:43 +0100 [thread overview]
Message-ID: <1d43153f-215a-4e2f-810f-553e4192c27f@redhat.com> (raw)
In-Reply-To: <CAGYh1E-4fiF+Y0JBKPRwJNbuJzdJuWnR6yA-eNLBjW9++xov3w@mail.gmail.com>
On 11/30/23 10:52, YangHang Liu wrote:
> After applying this patch, the VM with a igbvf will not crash during reboot.
>
> Tested-by: Yanghang Liu<yanghliu@redhat.com <mailto:yanghliu@redhat.com>>
Michael, do you have plans to send a PR for -rc3 ?
Thanks,
C.
>
> On Mon, Nov 27, 2023 at 5:12 PM Cédric Le Goater <clg@redhat.com <mailto:clg@redhat.com>> wrote:
>
> On 11/23/23 08:56, Akihiko Odaki wrote:
> > g_new() aborts if the allocation fails so it returns NULL only if the
> > requested allocation size is zero. register_vfs() makes such an
> > allocation if NumVFs is zero so it should not assert that g_new()
> > returns a non-NULL value.
> >
> > Fixes: 7c0fa8dff8 ("pcie: Add support for Single Root I/O Virtualization (SR/IOV)")
> > Buglink: https://issues.redhat.com/browse/RHEL-17209 <https://issues.redhat.com/browse/RHEL-17209>
> > Signed-off-by: Akihiko Odaki <akihiko.odaki@daynix.com <mailto:akihiko.odaki@daynix.com>>
>
>
> Reviewed-by: Cédric Le Goater <clg@redhat.com <mailto:clg@redhat.com>>
>
> Thanks,
>
> C.
>
>
> > ---
> > hw/pci/pcie_sriov.c | 1 -
> > 1 file changed, 1 deletion(-)
> >
> > diff --git a/hw/pci/pcie_sriov.c b/hw/pci/pcie_sriov.c
> > index 5ef8950940..a1fe65f5d8 100644
> > --- a/hw/pci/pcie_sriov.c
> > +++ b/hw/pci/pcie_sriov.c
> > @@ -178,7 +178,6 @@ static void register_vfs(PCIDevice *dev)
> > num_vfs = pci_get_word(dev->config + sriov_cap + PCI_SRIOV_NUM_VF);
> >
> > dev->exp.sriov_pf.vf = g_new(PCIDevice *, num_vfs);
> > - assert(dev->exp.sriov_pf.vf);
> >
> > trace_sriov_register_vfs(dev->name, PCI_SLOT(dev->devfn),
> > PCI_FUNC(dev->devfn), num_vfs);
>
>
next prev parent reply other threads:[~2023-11-30 15:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-23 7:56 [PATCH] pcie_sriov: Remove g_new assertion Akihiko Odaki
2023-11-23 10:05 ` [PATCH-for-8.2] " Philippe Mathieu-Daudé
2023-11-27 9:11 ` [PATCH] " Cédric Le Goater
2023-11-30 9:52 ` YangHang Liu
2023-11-30 15:37 ` Cédric Le Goater [this message]
2023-11-30 16:12 ` Michael S. Tsirkin
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=1d43153f-215a-4e2f-810f-553e4192c27f@redhat.com \
--to=clg@redhat.com \
--cc=akihiko.odaki@daynix.com \
--cc=alex.bennee@linaro.org \
--cc=marcel.apfelbaum@gmail.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=yanghliu@redhat.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).