All of lore.kernel.org
 help / color / mirror / Atom feed
* [bug report] powerpc/mm: dump block address translation on book3s/32
@ 2019-02-22 10:43 Dan Carpenter
  2019-02-22 11:08 ` Christophe Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2019-02-22 10:43 UTC (permalink / raw)
  To: christophe.leroy; +Cc: linuxppc-dev

Hello Christophe Leroy,

The patch 7c91efce1608: "powerpc/mm: dump block address translation
on book3s/32" from Dec 3, 2018, leads to the following static checker
warning:

	arch/powerpc/mm/dump_bats.c:20 pp_601()
	warn: both sides of ternary the same: '"RWX"'

arch/powerpc/mm/dump_bats.c
    13 static char *pp_601(int k, int pp)
    14 {
    15 	if (pp == 0)
    16 		return k ? "NA" : "RWX";
    17 	if (pp == 1)
    18 		return k ? "ROX" : "RWX";
    19 	if (pp == 2)
--> 20 		return k ? "RWX" : "RWX";
                            ^^^     ^^^
    21 	return k ? "ROX" : "ROX";
                    ^^^     ^^^

Was something else intended here?  Or we could make it simpler:

	if (pp == 2)
		return "RWX";
	return "ROX";


    22 }

regards,
dan carpenter

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [bug report] powerpc/mm: dump block address translation on book3s/32
  2019-02-22 10:43 [bug report] powerpc/mm: dump block address translation on book3s/32 Dan Carpenter
@ 2019-02-22 11:08 ` Christophe Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Christophe Leroy @ 2019-02-22 11:08 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: linuxppc-dev

  Hello Dan,


Le 22/02/2019 à 11:43, Dan Carpenter a écrit :
> Hello Christophe Leroy,
> 
> The patch 7c91efce1608: "powerpc/mm: dump block address translation
> on book3s/32" from Dec 3, 2018, leads to the following static checker
> warning:
> 
> 	arch/powerpc/mm/dump_bats.c:20 pp_601()
> 	warn: both sides of ternary the same: '"RWX"'
> 
> arch/powerpc/mm/dump_bats.c
>      13 static char *pp_601(int k, int pp)
>      14 {
>      15 	if (pp == 0)
>      16 		return k ? "NA" : "RWX";
>      17 	if (pp == 1)
>      18 		return k ? "ROX" : "RWX";
>      19 	if (pp == 2)
> --> 20 		return k ? "RWX" : "RWX";
>                              ^^^     ^^^
>      21 	return k ? "ROX" : "ROX";
>                      ^^^     ^^^
> 
> Was something else intended here?  Or we could make it simpler:
> 
> 	if (pp == 2)
> 		return "RWX";
> 	return "ROX";
> 
> 
>      22 }
> 

The intention was to map the following table from the mpc601 user manual 
chapter 6.4:

Table 6-7. Access Protection Control with Key

Key(1)  PP(2)  Block or Page Type
0       00     Read/write
0       01     Read/write
0       10     Read/write
0       11     Read only
1       00     No access
1       01     Read only
1       10     Read/write
1       11     Read only

(1) Ks or Ku selected by state of MSR[PR]
(2) PP protection option bits in BAT array entry or
PTE


So I have no objection for your proposed change

Regards
Christophe

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2019-02-22 11:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-22 10:43 [bug report] powerpc/mm: dump block address translation on book3s/32 Dan Carpenter
2019-02-22 11:08 ` Christophe Leroy

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.