powerpc/mm/radix: Make the pid unsigned long

Michael Ellerman mpe at ellerman.id.au
Wed Jun 8 13:58:50 AEST 2016


On Thu, 2016-02-06 at 09:44:48 UTC, "Aneesh Kumar K.V" wrote:
> Semantic Issue: comparison of constant 18446744073709551615 with
> expression of type 'unsigned int' is always false.
> 
> Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
> Reviewed-by: Balbir Singh <bsingharora at gmail.com>
> ---
>  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.
    
    Fixes: 1a472c9dba6b ("powerpc/mm/radix: Add tlbflush routines")
    Signed-off-by: Aneesh Kumar K.V <aneesh.kumar at linux.vnet.ibm.com>
    Reviewed-by: Balbir Singh <bsingharora at gmail.com>
    [mpe: Write change log]
    Signed-off-by: Michael Ellerman <mpe at ellerman.id.au>

cheers


More information about the Linuxppc-dev mailing list