* Re: Fix up mmap of /dev/kmem
[not found] <200508132201.j7DM1TAN031499@hera.kernel.org>
@ 2005-08-15 13:04 ` Olaf Hering
2005-08-24 12:12 ` 2.6.13-rc7 compile failures (was: Re: Fix up mmap of /dev/kmem) Geert Uytterhoeven
1 sibling, 0 replies; 3+ messages in thread
From: Olaf Hering @ 2005-08-15 13:04 UTC (permalink / raw)
To: Linux Kernel Mailing List
On Sat, Aug 13, Linux Kernel Mailing List wrote:
> tree e52389322e063c5b784ead6ec314503f7646c765
> parent 2da5bf80f754e28cc153362e5ed1edaa9740897a
> author Linus Torvalds <torvalds@g5.osdl.org> Sun, 14 Aug 2005 04:22:59 -0700
> committer Linus Torvalds <torvalds@g5.osdl.org> Sun, 14 Aug 2005 04:22:59 -0700
>
> Fix up mmap of /dev/kmem
>
> This leaves the issue of whether we should deprecate the whole thing (or
> if we should check the whole mmap range, for that matter) open. Just do
> the minimal fix for now.
>
> drivers/char/mem.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/mem.c b/drivers/char/mem.c
> --- a/drivers/char/mem.c
> +++ b/drivers/char/mem.c
> @@ -261,7 +261,11 @@ static int mmap_mem(struct file * file,
>
> static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
> {
> - unsigned long long val;
> + unsigned long pfn;
> +
> + /* Turn a kernel-virtual address into a physical page frame */
> + pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT;
> +
> /*
> * RED-PEN: on some architectures there is more mapped memory
> * than available in mem_map which pfn_valid checks
make all ARCH=um SUBARCH=i386 V=1
This gives
drivers/char/mem.c: In function 'mmap_kmem':
drivers/char/mem.c:267: error: invalid operands to binary <<
static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
{
unsigned long pfn;
pfn = to_phys((void *) (unsigned long) (u64)vma->vm_pgoff << 12) >> 12;
# 276 "drivers/char/mem.c"
if (!((pfn) < max_mapnr))
return -5;
^ permalink raw reply [flat|nested] 3+ messages in thread
* 2.6.13-rc7 compile failures (was: Re: Fix up mmap of /dev/kmem)
[not found] <200508132201.j7DM1TAN031499@hera.kernel.org>
2005-08-15 13:04 ` Fix up mmap of /dev/kmem Olaf Hering
@ 2005-08-24 12:12 ` Geert Uytterhoeven
2005-08-24 15:36 ` Andreas Schwab
1 sibling, 1 reply; 3+ messages in thread
From: Geert Uytterhoeven @ 2005-08-24 12:12 UTC (permalink / raw)
To: Linus Torvalds; +Cc: Linux Kernel Development
On Sat, 13 Aug 2005, Linux Kernel Mailing List wrote:
> Fix up mmap of /dev/kmem
>
> This leaves the issue of whether we should deprecate the whole thing (or
> if we should check the whole mmap range, for that matter) open. Just do
> the minimal fix for now.
>
> drivers/char/mem.c | 12 ++++++++----
> 1 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/char/mem.c b/drivers/char/mem.c
> --- a/drivers/char/mem.c
> +++ b/drivers/char/mem.c
> @@ -261,7 +261,11 @@ static int mmap_mem(struct file * file,
>
> static int mmap_kmem(struct file * file, struct vm_area_struct * vma)
> {
> - unsigned long long val;
> + unsigned long pfn;
> +
> + /* Turn a kernel-virtual address into a physical page frame */
> + pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT;
> +
> /*
> * RED-PEN: on some architectures there is more mapped memory
> * than available in mem_map which pfn_valid checks
Some (not all!) of my m68k test builds are now failing with:
| linux-m68k-2.6.13-rc7/drivers/char/mem.c: In function `mmap_kmem':
| linux-m68k-2.6.13-rc7/drivers/char/mem.c:267: warning: cast to pointer from integer of different size
| linux-m68k-2.6.13-rc7/drivers/char/mem.c:267: invalid operands to binary <<
Gr{oetje,eeting}s,
Geert
--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: 2.6.13-rc7 compile failures (was: Re: Fix up mmap of /dev/kmem)
2005-08-24 12:12 ` 2.6.13-rc7 compile failures (was: Re: Fix up mmap of /dev/kmem) Geert Uytterhoeven
@ 2005-08-24 15:36 ` Andreas Schwab
0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2005-08-24 15:36 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: Linus Torvalds, Linux Kernel Development
Geert Uytterhoeven <geert@linux-m68k.org> writes:
> Some (not all!) of my m68k test builds are now failing with:
>
> | linux-m68k-2.6.13-rc7/drivers/char/mem.c: In function `mmap_kmem':
> | linux-m68k-2.6.13-rc7/drivers/char/mem.c:267: warning: cast to pointer from integer of different size
> | linux-m68k-2.6.13-rc7/drivers/char/mem.c:267: invalid operands to binary <<
Try this:
Add parens around macro parameters.
Signed-off-by: Andreas Schwab <schwab@suse.de>
--- include/asm-m68k/page.h.~1.14.~ 2004-05-26 20:10:15.000000000 +0200
+++ include/asm-m68k/page.h 2005-08-24 17:29:55.000000000 +0200
@@ -138,13 +138,13 @@ extern unsigned long m68k_memoffset;
#define __pa(vaddr) ((unsigned long)(vaddr)+m68k_memoffset)
#define __va(paddr) ((void *)((unsigned long)(paddr)-m68k_memoffset))
#else
-#define __pa(vaddr) virt_to_phys((void *)vaddr)
-#define __va(paddr) phys_to_virt((unsigned long)paddr)
+#define __pa(vaddr) virt_to_phys((void *)(vaddr))
+#define __va(paddr) phys_to_virt((unsigned long)(paddr))
#endif
#else /* !CONFIG_SUN3 */
/* This #define is a horrible hack to suppress lots of warnings. --m */
-#define __pa(x) ___pa((unsigned long)x)
+#define __pa(x) ___pa((unsigned long)(x))
static inline unsigned long ___pa(unsigned long x)
{
if(x == 0)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2005-08-24 15:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <200508132201.j7DM1TAN031499@hera.kernel.org>
2005-08-15 13:04 ` Fix up mmap of /dev/kmem Olaf Hering
2005-08-24 12:12 ` 2.6.13-rc7 compile failures (was: Re: Fix up mmap of /dev/kmem) Geert Uytterhoeven
2005-08-24 15:36 ` Andreas Schwab
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox