From: "Cédric Le Goater" <clg@kaod.org>
To: "Alexey Kardashevskiy" <aik@ozlabs.ru>,
"Colin Ian King" <colin.king@canonical.com>,
"Paolo Bonzini" <pbonzini@redhat.com>,
"Radim Krčmář" <rkrcmar@redhat.com>,
kvm@vger.kernel.org
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: KVM: Introduce a 'release' method for KVM devices
Date: Mon, 6 May 2019 11:50:03 +0200 [thread overview]
Message-ID: <457f6636-35da-1cb6-4763-2d717bcc421e@kaod.org> (raw)
In-Reply-To: <2e7890d2-e433-8553-c466-5b42f7d7776e@ozlabs.ru>
On 5/2/19 4:35 AM, Alexey Kardashevskiy wrote:
>
>
> On 02/05/2019 00:42, Colin Ian King wrote:
>> Hi,
>>
>> Static analysis with Coverity picked up an issue in the following commit:
>>
>> commit 2bde9b3ec8bdf60788e9e2ce8c07a2f8d6003dbd
>> Author: Cédric Le Goater <clg@kaod.org>
>> Date: Thu Apr 18 12:39:41 2019 +0200
>>
>> KVM: Introduce a 'release' method for KVM devices
>>
>>
>> struct kvm *kvm = dev->kvm;
>>
>> + if (!dev)
>> + return -ENODEV;
>>
>> If dev is null then the dereference of dev->kvm when assigning pointer
>> kvm will cause an null pointer dereference. This is easily fixed by
>> assigning kvm after the dev null check.
>
> Yes, this is a bug.
Clearly.
>>
>> +
>> + if (dev->kvm != kvm)
>> + return -EPERM;
>>
>> I don't understand the logic of the above check. kvm is the same
>> dev->kvm on the earlier assignment, so dev->kvm != kvm seems to be
>> always false, so this check seems to be redundant. Am I missing
>> something more fundamental here?
>
> Nope. This looks like unfortunate cut-n-paste which slipped through out
> reviewing process :-D
Yes. My bad :/ I will send a cleanup patch for 5.2
Thanks,
C.
prev parent reply other threads:[~2019-05-06 11:06 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 14:42 Colin Ian King
2019-05-02 2:35 ` Alexey Kardashevskiy
2019-05-06 9:50 ` Cédric Le Goater [this message]
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=457f6636-35da-1cb6-4763-2d717bcc421e@kaod.org \
--to=clg@kaod.org \
--cc=aik@ozlabs.ru \
--cc=colin.king@canonical.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=rkrcmar@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
all inboxes | Powered by JetHome®