[bug report] powerpc/mm/radix: Avoid flushing the PWC on every flush_tlb_range

Tyrel Datwyler tyreld at linux.vnet.ibm.com
Sat Aug 12 08:16:08 AEST 2017


On 08/11/2017 01:15 PM, Dan Carpenter wrote:
> Hello Benjamin Herrenschmidt,
> 
> This is a semi-automatic email about new static checker warnings.
> 
> The patch 424de9c6e3f8: "powerpc/mm/radix: Avoid flushing the PWC on 
> every flush_tlb_range" from Jul 19, 2017, leads to the following 
> Smatch complaint:
> 
> arch/powerpc/mm/tlb-radix.c:368 radix__flush_tlb_collapsed_pmd()
> 	 error: we previously assumed 'mm' could be null (see line 362)
> 
> arch/powerpc/mm/tlb-radix.c
>    361	
>    362		pid = mm ? mm->context.id : 0;
>                       ^^
> Check for NULL.
> 
>    363		if (unlikely(pid == MMU_NO_CONTEXT))
>    364			goto no_context;
>    365	
>    366		/* 4k page size, just blow the world */
>    367		if (PAGE_SIZE == 0x1000) {
>    368			radix__flush_all_mm(mm);
>                                             ^^
> Unchecked dereference.

Appears to be a false positive. MMU_NO_CONTEXT I believe is defined as "0". So, maybe it
would be clearer that we take the goto branch if this line read:

362		pid = mm ? mm->context.id : MMU_NO_CONTEXT;

-Tyrel

> 
>    369			return;
>    370		}
> 
> regards,
> dan carpenter
> 



More information about the Linuxppc-dev mailing list