mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Incorrect #ifdef in arch/x86/mm/pat.c
@ 2009-02-20 22:39 Dheeraj Reddy
  2009-02-20 22:58 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Dheeraj Reddy @ 2009-02-20 22:39 UTC (permalink / raw)
  To: linux-kernel

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,




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Incorrect #ifdef in arch/x86/mm/pat.c
  2009-02-20 22:39 Incorrect #ifdef in arch/x86/mm/pat.c Dheeraj Reddy
@ 2009-02-20 22:58 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2009-02-20 22:58 UTC (permalink / raw)
  To: Dheeraj Reddy
  Cc: linux-kernel, Suresh Siddha, Pallipadi, Venkatesh, Arjan van de Ven


* Dheeraj Reddy <dheerajr@gmail.com> wrote:

> 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

no - see the comment in pat.c:

/* This check is done in drivers/char/mem.c in case of STRICT_DEVMEM*/

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-02-20 22:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-02-20 22:39 Incorrect #ifdef in arch/x86/mm/pat.c Dheeraj Reddy
2009-02-20 22:58 ` Ingo Molnar

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®