[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
i386 pgd_index() doesn't parenthesize its arg
- To: akpm@zip.com.au
- Subject: i386 pgd_index() doesn't parenthesize its arg
- From: William Lee Irwin III <wli@holomorphy.com>
- Date: Thu, 16 Jan 2003 21:51:28 -0800
- Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
- Fake-Sender: owner-linux-mm@kvack.org
- Mail-Followup-To: William Lee Irwin III <wli@holomorphy.com>,akpm@zip.com.au, linux-kernel@vger.kernel.org, linux-mm@kvack.org
- Organization: The Domain of Holomorphy
- Original-Recipient: rfc822;linux-mm-archive@humbolt.geo.uu.nl
- Sender: Rik van Riel <riel@nl.linux.org>
- User-Agent: Mutt/1.3.25i
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.
vs. 2.5.59
-- wli
===== include/asm-i386/pgtable.h 1.22 vs edited =====
--- 1.22/include/asm-i386/pgtable.h Mon Nov 25 14:41:15 2002
+++ edited/include/asm-i386/pgtable.h Thu Jan 16 21:08:06 2003
@@ -242,7 +242,7 @@
((pmd_val(pmd) & (_PAGE_PSE|_PAGE_PRESENT)) == (_PAGE_PSE|_PAGE_PRESENT))
/* 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)
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/