Commit 70494a78 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] i386 pgd_index() doesn't parenthesize its arg

Patch from William Lee Irwin III <wli@holomorphy.com>

pgd_index() doesn't parenthesize its argument.  This is a bad idea for
macros, since it's legitimate to pass expressions to them that will get
misinterpreted given operator precedence and the shift.
parent e7700cb5
...@@ -242,7 +242,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot) ...@@ -242,7 +242,7 @@ static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
((pmd_val(pmd) & (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT)) ((pmd_val(pmd) & (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT))
/* to find an entry in a page-table-directory. */ /* to find an entry in a page-table-directory. */
#define pgd_index(address) ((address >> PGDIR_SHIFT) & (PTRS_PER_PGD-1)) #define pgd_index(address) (((address) >> PGDIR_SHIFT) & (PTRS_PER_PGD-1))
#define __pgd_offset(address) pgd_index(address) #define __pgd_offset(address) pgd_index(address)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment