From: David Hildenbrand <david@redhat.com>
To: "Markus Elfring" <Markus.Elfring@web.de>,
linux-s390@vger.kernel.org, kvm@vger.kernel.org,
"Christian Bornträger" <borntraeger@de.ibm.com>,
"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
"Cornelia Huck" <cohuck@redhat.com>,
"Heiko Carstens" <heiko.carstens@de.ibm.com>,
"Janosch Frank" <frankja@linux.ibm.com>,
"Vasily Gorbik" <gor@linux.ibm.com>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: Re: KVM: s390/mm: Clarification for two return value checks in gmap_shadow()
Date: Sat, 2 May 2020 19:27:31 +0200 [thread overview]
Message-ID: <993d6b88-1f8f-745e-90b6-6ab0917a57a6@redhat.com> (raw)
In-Reply-To: <7f0b7ac0-d061-9484-bc5e-bdd9e32aa42b@web.de>
On 02.05.20 17:43, Markus Elfring wrote:
> Hello,
>
> I have tried another small script out for the semantic patch language.
> This source code analysis approach points out that the function “gmap_find_shadow”
> is called two times by the function “gmap_shadow”.
> https://elixir.bootlin.com/linux/v5.7-rc3/source/arch/s390/mm/gmap.c#L1628
> https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/log/arch/s390/mm/gmap.c
>
> Null pointer checks are performed at these places.
Right, in case we have already a shadow, we return it. In case we are
just concurrently creating/initializing another one, we return -EINVAL
so the caller will retry (and find the fully initialized one). In case
we get NULL, we have to create a new one.
> The function “gmap_find_shadow” is documented in the same source file
> that the pointer “ERR_PTR(-EAGAIN)” can eventually be returned.
> Are the referenced gmap data structures always initialised here?
-EAGAIN makes sure that we are not touching partially initialized one.
In case we find a valid gmap shadow, it is fully initialized. That's
what we have the ->initialized field for.
Hope that answers your question.
--
Thanks,
David / dhildenb
prev parent reply other threads:[~2020-05-02 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-02 15:43 Markus Elfring
2020-05-02 17:27 ` David Hildenbrand [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=993d6b88-1f8f-745e-90b6-6ab0917a57a6@redhat.com \
--to=david@redhat.com \
--cc=Markus.Elfring@web.de \
--cc=borntraeger@de.ibm.com \
--cc=cohuck@redhat.com \
--cc=frankja@linux.ibm.com \
--cc=gor@linux.ibm.com \
--cc=heiko.carstens@de.ibm.com \
--cc=imbrenda@linux.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-s390@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
all inboxes | Powered by JetHome®