From: Navid Emamdoost <navid.emamdoost@gmail.com>
To: emamd001@umn.edu
Cc: kjlu@umn.edu, smccaman@umn.edu,
Navid Emamdoost <navid.emamdoost@gmail.com>,
Mike Kravetz <mike.kravetz@oracle.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm/hugetlb.c: check the failure case for find_vma
Date: Wed, 24 Jul 2019 20:39:44 -0500 [thread overview]
Message-ID: <20190725013944.20661-1-navid.emamdoost@gmail.com> (raw)
find_vma may fail and return NULL. The null check is added.
Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
---
mm/hugetlb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index ede7e7f5d1ab..9c5e8b7a6476 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -4743,6 +4743,9 @@ void adjust_range_if_pmd_sharing_possible(struct vm_area_struct *vma,
pte_t *huge_pmd_share(struct mm_struct *mm, unsigned long addr, pud_t *pud)
{
struct vm_area_struct *vma = find_vma(mm, addr);
+ if (!vma)
+ return (pte_t *)pmd_alloc(mm, pud, addr);
+
struct address_space *mapping = vma->vm_file->f_mapping;
pgoff_t idx = ((addr - vma->vm_start) >> PAGE_SHIFT) +
vma->vm_pgoff;
--
2.17.1
next reply other threads:[~2019-07-25 1:40 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-25 1:39 Navid Emamdoost [this message]
2019-07-25 17:53 ` Mike Kravetz
2019-07-25 18:02 ` Navid Emamdoost
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=20190725013944.20661-1-navid.emamdoost@gmail.com \
--to=navid.emamdoost@gmail.com \
--cc=emamd001@umn.edu \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mike.kravetz@oracle.com \
--cc=smccaman@umn.edu \
/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