mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dheeraj Reddy <dheerajr@gmail.com>
To: linux-kernel@vger.kernel.org
Subject: Incorrect #ifdef in arch/x86/mm/pat.c
Date: Fri, 20 Feb 2009 22:39:13 +0000 (UTC)	[thread overview]
Message-ID: <loom.20090220T223617-127@post.gmane.org> (raw)

Hello there,
    The checks for reading /dev/kmem and /dev/mem in arch/x86/mm/pat.c seems to 
be incorrect when CONFIG_STRICT_DEVMEM is set.
Following patch corrects it.
The check should always return 1 when CONFIG_STRICT_DEVMEM is not defined, 
similar to what is in drivers/char/mem.c

truly
dheeraj

[dreddy-desktop:~/Ksources/git.linux-2.6]$ git diff
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index aebbf67..2aff276 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -503,12 +503,6 @@ pgprot_t phys_mem_access_prot(struct file *file, unsigned 
l
 }

 #ifdef CONFIG_STRICT_DEVMEM
-/* This check is done in drivers/char/mem.c in case of STRICT_DEVMEM*/
-static inline int range_is_allowed(unsigned long pfn, unsigned long size)
-{
-       return 1;
-}
-#else
 /* This check is needed to avoid cache aliasing when PAT is enabled */
 static inline int range_is_allowed(unsigned long pfn, unsigned long size)
 {
@@ -531,6 +525,12 @@ static inline int range_is_allowed(unsigned long pfn, 
unsig
        }
        return 1;
 }
+#else
+/* This check is done in drivers/char/mem.c in case of STRICT_DEVMEM*/
+static inline int range_is_allowed(unsigned long pfn, unsigned long size)
+{
+       return 1;
+}
 #endif /* CONFIG_STRICT_DEVMEM */

 int phys_mem_access_prot_allowed(struct file *file, unsigned long pfn,




             reply	other threads:[~2009-02-20 22:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-20 22:39 Dheeraj Reddy [this message]
2009-02-20 22:58 ` Ingo Molnar

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=loom.20090220T223617-127@post.gmane.org \
    --to=dheerajr@gmail.com \
    --cc=linux-kernel@vger.kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®