powerpc/mm/radix: Make the pid unsigned long
PATCH 1/1 powerpc/mm/radix: Make the pid unsigned long
Semantic Issue: comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false.
--- arch/powerpc/mm/tlb-radix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
arch/powerpc/mm/tlb-radix.c +4 -4
@@ -115,7 +115,7 @@ static inline void _tlbie_va(unsigned long va, unsigned long pid,*/ void radix__local_flush_tlb_mm (struct mm_struct *mm) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm->context.id;
@@ -128,7 +128,7 @@ EXPORT_SYMBOL(radix__local_flush_tlb_mm);void radix___local_flush_tlb_page (struct mm_struct *mm,unsigned long vmaddr,unsigned long ap,int nid) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm ? mm->context.id :0 ;
@@ -158,7 +158,7 @@ static int mm_is_core_local(struct mm_struct *mm)void radix__flush_tlb_mm (struct mm_struct *mm) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm->context.id;
@@ -207,7 +207,7 @@ EXPORT_SYMBOL(radix__flush_tlb_mm_pwc);void radix___flush_tlb_page (struct mm_struct *mm,unsigned long vmaddr,unsigned long ap,int nid) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm ? mm->context.id :0 ;
Signature · 1 line
2.7.4
Quoted 41 lines · Aneesh Kumar K.V
Semantic Issue: comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false.
Signed-off-by Aneesh Kumar K.V <[email protected]>--- arch/powerpc/mm/tlb-radix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)arch/powerpc/mm/tlb-radix.c +3
-3@@ -115,7 +115,7 @@ static inline void _tlbie_va(unsigned long va, unsigned long pid,*/ void radix__local_flush_tlb_mm (struct mm_struct *mm) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm->context.id;@@ -128,7 +128,7 @@ EXPORT_SYMBOL(radix__local_flush_tlb_mm);void radix___local_flush_tlb_page (struct mm_struct *mm,unsigned long vmaddr,unsigned long ap,int nid) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm ? mm->context.id :0 ;@@ -158,7 +158,7 @@ static int mm_is_core_local(struct mm_struct *mm)void radix__flush_tlb_mm (struct mm_struct *mm) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm->context.id;
arch/powerpc/mm/tlb-radix.c EXPORT_SYMBOL(radix__flush_tlb_mm_pwc); · line 213
Quoted 8 lines
arch/powerpc/mm/tlb-radix.c +1
-1@@ -207,7 +207,7 @@ EXPORT_SYMBOL(radix__flush_tlb_mm_pwc);void radix___flush_tlb_page (struct mm_struct *mm,unsigned long vmaddr,unsigned long ap,int nid) { -unsigned int pid; +unsigned long pid;preempt_disable (); pid = mm ? mm->context.id :0 ;
Quoted 8 lines · Aneesh Kumar K.V
Semantic Issue: comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false.
Signed-off-by Aneesh Kumar K.V <[email protected]>Reviewed-by Balbir Singh <[email protected]>--- arch/powerpc/mm/tlb-radix.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
I'm going to take this as a fix, I rewrote the change log to:
powerpc/mm/radix: Fix always false comparison against MMU_NO_CONTEXT
In some of the radix TLB flush routines, we use a local to store the mm->context.id, AKA the PID.
Currently we use an int, but the PID is unsigned long, so large values of PID will be truncated. In particular MMU_NO_CONTEXT is -1, which means all our comparisons against that value can never be true.
This means we'll issue TLB flushes when we shouldn't on radix enabled machines.
Fix it by using an unsigned long for the local. Discovered by Coverity.
cheers
Quoted 5 lines · Aneesh Kumar K.V
Semantic Issue: comparison of constant 18446744073709551615 with expression of type 'unsigned int' is always false.
Signed-off-by Aneesh Kumar K.V <[email protected]>Reviewed-by Balbir Singh <[email protected]>
Applied to powerpc fixes, thanks.
https://git.kernel.org/powerpc/c/9690c15742688e9cb5ee4aa0b0
cheers