From: Diana Craciun OSS <diana.craciun@oss.nxp.com>
To: Alex Williamson <alex.williamson@redhat.com>,
Colin King <colin.king@canonical.com>
Cc: Cornelia Huck <cohuck@redhat.com>,
Eric Auger <eric.auger@redhat.com>,
kvm@vger.kernel.org, kernel-janitors@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] vfio/fsl-mc: fix the return of the uninitialized variable ret
Date: Fri, 16 Oct 2020 12:26:52 +0300 [thread overview]
Message-ID: <65c7ffdb-fa92-102d-d7d1-29bb7d39fcb7@oss.nxp.com> (raw)
In-Reply-To: <20201015125211.3ff46dc1@w520.home>
On 10/15/2020 9:52 PM, Alex Williamson wrote:
> On Thu, 15 Oct 2020 13:22:26 +0100
> Colin King <colin.king@canonical.com> wrote:
>
>> From: Colin Ian King <colin.king@canonical.com>
>>
>> Currently the success path in function vfio_fsl_mc_reflck_attach is
>> returning an uninitialized value in variable ret. Fix this by setting
>> this to zero to indicate success.
>>
>> Addresses-Coverity: ("Uninitialized scalar variable")
>> Fixes: f2ba7e8c947b ("vfio/fsl-mc: Added lock support in preparation for interrupt handling")
>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>> ---
>> drivers/vfio/fsl-mc/vfio_fsl_mc.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
>> index 80fc7f4ed343..42a5decb78d1 100644
>> --- a/drivers/vfio/fsl-mc/vfio_fsl_mc.c
>> +++ b/drivers/vfio/fsl-mc/vfio_fsl_mc.c
>> @@ -84,6 +84,7 @@ static int vfio_fsl_mc_reflck_attach(struct vfio_fsl_mc_device *vdev)
>> vfio_fsl_mc_reflck_get(cont_vdev->reflck);
>> vdev->reflck = cont_vdev->reflck;
>> vfio_device_put(device);
>> + ret = 0;
>> }
>>
>> unlock:
>
> Looks correct to me, unless Diana would rather set the initial value to
> zero instead. Thanks,
>
> Alex
>
I prefer to initialize the variable to 0 when it's defined. I'll send a
patch for it.
Thanks,
Diana
next prev parent reply other threads:[~2020-10-16 9:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-15 12:22 [PATCH] vfio/fsl-mc: fix the return of the uninitialized variable ret Colin King
2020-10-15 18:52 ` Alex Williamson
2020-10-16 9:26 ` Diana Craciun OSS [this message]
2020-10-16 9:49 ` Colin Ian King
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=65c7ffdb-fa92-102d-d7d1-29bb7d39fcb7@oss.nxp.com \
--to=diana.craciun@oss.nxp.com \
--cc=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=colin.king@canonical.com \
--cc=eric.auger@redhat.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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