From: Peter Zijlstra <peterz@infradead.org>
To: cgel.zte@gmail.com
Cc: dave.hansen@linux.intel.com, luto@kernel.org, tglx@linutronix.de,
mingo@redhat.com, bp@alien8.de, x86@kernel.org, hpa@zytor.com,
jan.kiszka@siemens.com, jmoyer@redhat.com,
dan.j.williams@intel.com, neilb@suse.de, yang.guang5@zte.com.cn,
linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH] Modify the check condition
Date: Sat, 18 Sep 2021 10:31:20 +0200 [thread overview]
Message-ID: <20210918083120.GM4323@worktop.programming.kicks-ass.net> (raw)
In-Reply-To: <20210918065232.239336-1-yang.guang5@zte.com.cn>
On Sat, Sep 18, 2021 at 06:52:32AM +0000, cgel.zte@gmail.com wrote:
> From: Yang Guang <yang.guang5@zte.com.cn>
>
> The vma may be NULL, and accessing the member of vma like "vma->vm_start"
> in calling follow_phys may occur segmentation fault.
> So it should check vma at beginning. If vma is null, it will return. And
> the if condition won't execute "vm->vm_flags".
>
> Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
> ---
> arch/x86/mm/pat/memtype.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/arch/x86/mm/pat/memtype.c b/arch/x86/mm/pat/memtype.c
> index 4ba2a3ee4bce..b7108b37b754 100644
> --- a/arch/x86/mm/pat/memtype.c
> +++ b/arch/x86/mm/pat/memtype.c
> @@ -1089,7 +1089,7 @@ void untrack_pfn(struct vm_area_struct *vma, unsigned long pfn,
> resource_size_t paddr;
> unsigned long prot;
>
> - if (vma && !(vma->vm_flags & VM_PAT))
> + if (!(vma) || !(vma->vm_flags & VM_PAT))
> return;
Yet another braindead patch that shows you don't actually understand C.
next prev parent reply other threads:[~2021-09-18 8:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-18 6:52 [PATCH] Modify the check condition cgel.zte
2021-09-18 8:31 ` Peter Zijlstra [this message]
-- strict thread matches above, loose matches on Subject: below --
2021-09-18 6:15 cgel.zte
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=20210918083120.GM4323@worktop.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=bp@alien8.de \
--cc=cgel.zte@gmail.com \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=hpa@zytor.com \
--cc=jan.kiszka@siemens.com \
--cc=jmoyer@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=neilb@suse.de \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
--cc=yang.guang5@zte.com.cn \
/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