All of lore.kernel.org
 help / color / mirror / Atom feed
From: William Lee Irwin III <wli@holomorphy.com>
To: akpm@zip.com.au
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: i386 pgd_index() doesn't parenthesize its arg
Date: Thu, 16 Jan 2003 21:51:28 -0800	[thread overview]
Message-ID: <20030117055128.GP919@holomorphy.com> (raw)

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)
 

WARNING: multiple messages have this Message-ID (diff)
From: William Lee Irwin III <wli@holomorphy.com>
To: akpm@zip.com.au
Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: i386 pgd_index() doesn't parenthesize its arg
Date: Thu, 16 Jan 2003 21:51:28 -0800	[thread overview]
Message-ID: <20030117055128.GP919@holomorphy.com> (raw)

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/

             reply	other threads:[~2003-01-17  5:42 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-01-17  5:51 William Lee Irwin III [this message]
2003-01-17  5:51 ` i386 pgd_index() doesn't parenthesize its arg William Lee Irwin III
2003-01-17  6:03 ` William Lee Irwin III
2003-01-17  6:03   ` William Lee Irwin III

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030117055128.GP919@holomorphy.com \
    --to=wli@holomorphy.com \
    --cc=akpm@zip.com.au \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.