* [PATCH] Modify the check condition
@ 2021-09-18 6:15 cgel.zte
0 siblings, 0 replies; 3+ messages in thread
From: cgel.zte @ 2021-09-18 6:15 UTC (permalink / raw)
To: dave.hansen
Cc: luto, peterz, tglx, mingo, bp, x86, hpa, linux-kernel, Yang Guang
From: Yang Guang <yang.guang5@zte.com.cn>
The numa_distance is NULL or numa_alloc_distance() return error
state, It should return. So the "&&" should been changed to "||".
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
---
arch/x86/mm/numa.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/x86/mm/numa.c b/arch/x86/mm/numa.c
index 1e9b93b088db..fa73648aeeb0 100644
--- a/arch/x86/mm/numa.c
+++ b/arch/x86/mm/numa.c
@@ -419,7 +419,7 @@ static int __init numa_alloc_distance(void)
*/
void __init numa_set_distance(int from, int to, int distance)
{
- if (!numa_distance && numa_alloc_distance() < 0)
+ if (!numa_distance || numa_alloc_distance() < 0)
return;
if (from >= numa_distance_cnt || to >= numa_distance_cnt ||
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Modify the check condition
2021-09-18 6:52 cgel.zte
@ 2021-09-18 8:31 ` Peter Zijlstra
0 siblings, 0 replies; 3+ messages in thread
From: Peter Zijlstra @ 2021-09-18 8:31 UTC (permalink / raw)
To: cgel.zte
Cc: dave.hansen, luto, tglx, mingo, bp, x86, hpa, jan.kiszka, jmoyer,
dan.j.williams, neilb, yang.guang5, linux-kernel,
Greg Kroah-Hartman
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] Modify the check condition
@ 2021-09-18 6:52 cgel.zte
2021-09-18 8:31 ` Peter Zijlstra
0 siblings, 1 reply; 3+ messages in thread
From: cgel.zte @ 2021-09-18 6:52 UTC (permalink / raw)
To: dave.hansen
Cc: luto, peterz, tglx, mingo, bp, x86, hpa, jan.kiszka, jmoyer,
dan.j.williams, neilb, yang.guang5, linux-kernel
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;
/* free the chunk starting from pfn or the whole chunk */
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2021-09-18 8:33 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-18 6:15 [PATCH] Modify the check condition cgel.zte
2021-09-18 6:52 cgel.zte
2021-09-18 8:31 ` Peter Zijlstra
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.