From: Dan Carpenter <dan.carpenter@oracle.com>
To: Alex Williamson <alex.williamson@redhat.com>
Cc: Wei Yongjun <weiyongjun1@huawei.com>,
Kirti Wankhede <kwankhede@nvidia.com>,
kvm@vger.kernel.org, kernel-janitors@vger.kernel.org,
Hulk Robot <hulkci@huawei.com>,
kraxel@redhat.com
Subject: Re: [PATCH -next] samples: vfio-mdev: fix error return code in mdpy_fb_probe()
Date: Thu, 20 May 2021 08:25:16 +0300 [thread overview]
Message-ID: <20210520052516.GA1955@kadam> (raw)
In-Reply-To: <20210519094512.7ed3ea0f.alex.williamson@redhat.com>
On Wed, May 19, 2021 at 09:45:12AM -0600, Alex Williamson wrote:
> On Wed, 19 May 2021 14:15:59 +0000
> Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> > Fix to return negative error code -ENOMEM from the error handling
> > case instead of 0, as done elsewhere in this function.
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
> > ---
> > samples/vfio-mdev/mdpy-fb.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/samples/vfio-mdev/mdpy-fb.c b/samples/vfio-mdev/mdpy-fb.c
> > index 21dbf63d6e41..d4abc0594dbd 100644
> > --- a/samples/vfio-mdev/mdpy-fb.c
> > +++ b/samples/vfio-mdev/mdpy-fb.c
> > @@ -131,8 +131,10 @@ static int mdpy_fb_probe(struct pci_dev *pdev,
> > width, height);
> >
> > info = framebuffer_alloc(sizeof(struct mdpy_fb_par), &pdev->dev);
> > - if (!info)
> > + if (!info) {
> > + ret = -ENOMEM;
> > goto err_release_regions;
> > + }
> > pci_set_drvdata(pdev, info);
> > par = info->par;
> >
> >
>
> I think there's also a question of why the three 'return -EINVAL;' exit
> paths between here and the prior call to pci_request_regions() don't
> also take this goto. Thanks,
>
Smatch catches one of these leaks... Which is weird that it would
ignore the other error paths. Perhaps it was intentional?
samples/vfio-mdev/mdpy-fb.c:135 mdpy_fb_probe() warn: missing error code 'ret'
samples/vfio-mdev/mdpy-fb.c:189 mdpy_fb_probe() warn: 'pdev' not released on lines: 120.
regards,
dan carpenter
next prev parent reply other threads:[~2021-05-20 5:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 14:15 [PATCH -next] samples: vfio-mdev: fix error return code in mdpy_fb_probe() Wei Yongjun
2021-05-19 15:45 ` Alex Williamson
2021-05-20 5:25 ` Dan Carpenter [this message]
2021-05-20 8:10 ` weiyongjun (A)
-- strict thread matches above, loose matches on Subject: below --
2020-04-27 14:21 Wei Yongjun
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=20210520052516.GA1955@kadam \
--to=dan.carpenter@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=hulkci@huawei.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kraxel@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=kwankhede@nvidia.com \
--cc=weiyongjun1@huawei.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