linux-mips
[Top] [All Lists]

Re: [PATCH] casts in TLB macros

To: Andrew Isaacson <adi@broadcom.com>
Subject: Re: [PATCH] casts in TLB macros
From: Ralf Baechle <ralf@linux-mips.org>
Date: Wed, 17 Aug 2005 11:08:30 +0100
Cc: linux-mips@linux-mips.org
In-reply-to: <20050817030608.GM24444@broadcom.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20050817030608.GM24444@broadcom.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mutt/1.4.2.1i
On Tue, Aug 16, 2005 at 08:06:08PM -0700, Andrew Isaacson wrote:

> Fix three cases where macro arguments are not parenthesized, leading to
> incorrect operator precedence when called with an expression as the
> argument.  This causes incorrect evaluation of
>     write_c0_entrylo0(pte_val(*ptep++) >> 6)
> when pte_t is 64 bits - the pte value is cast to (unsigned int) first,
> then the shift is done, losing the top 32 bits.
> 
> Also, this does not add an extra set of parentheses surrounding the
> (cast)(value) pair, as there's no danger of precedence problems to avoid
> given the high precedence of the cast operator and that this is the
> terminal macro in this macro trail.

Thanks, applied,

  Ralf

<Prev in Thread] Current Thread [Next in Thread>