All of lore.kernel.org
 help / color / mirror / Atom feed
* PATCH: Fix offset of mmap
@ 2001-09-14 17:07 H . J . Lu
  2001-09-14 17:10 ` James Simmons
  0 siblings, 1 reply; 4+ messages in thread
From: H . J . Lu @ 2001-09-14 17:07 UTC (permalink / raw)
  To: linux-mips

We should check if offset of mmap is on the page boundary.


H.J.
---
--- /tmp/tmp.20947.0	Fri Sep 14 10:05:33 2001
+++ arch/mips/kernel/syscall.c	Fri Sep 14 10:05:08 2001
@@ -82,6 +82,8 @@ out:
 asmlinkage unsigned long old_mmap(unsigned long addr, size_t len, int prot,
                                   int flags, int fd, off_t offset)
 {
+	if (offset & ~PAGE_MASK)
+		return -EINVAL;
 	return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
 }
 

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

* Re: PATCH: Fix offset of mmap
  2001-09-14 17:07 PATCH: Fix offset of mmap H . J . Lu
@ 2001-09-14 17:10 ` James Simmons
  2001-09-14 17:15   ` H . J . Lu
  0 siblings, 1 reply; 4+ messages in thread
From: James Simmons @ 2001-09-14 17:10 UTC (permalink / raw)
  To: H . J . Lu; +Cc: linux-mips


> We should check if offset of mmap is on the page boundary.

I believe this would break certain pieces of hardware. For example the
mq200 framebuffer in the sigmarion is not paged aligned. You have to
supply a offset to make it work.

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

* Re: PATCH: Fix offset of mmap
  2001-09-14 17:10 ` James Simmons
@ 2001-09-14 17:15   ` H . J . Lu
  2001-09-14 17:27     ` James Simmons
  0 siblings, 1 reply; 4+ messages in thread
From: H . J . Lu @ 2001-09-14 17:15 UTC (permalink / raw)
  To: James Simmons; +Cc: linux-mips

On Fri, Sep 14, 2001 at 10:10:58AM -0700, James Simmons wrote:
> 
> > We should check if offset of mmap is on the page boundary.
> 
> I believe this would break certain pieces of hardware. For example the
> mq200 framebuffer in the sigmarion is not paged aligned. You have to
> supply a offset to make it work.

How do you mmap a memory whose offset is not page aligned? The code
here is

return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
					    ^^^^^^^^^^^^^^^^^^^^

It is up to the user code to make sure everything is ok.


H.J.

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

* Re: PATCH: Fix offset of mmap
  2001-09-14 17:15   ` H . J . Lu
@ 2001-09-14 17:27     ` James Simmons
  0 siblings, 0 replies; 4+ messages in thread
From: James Simmons @ 2001-09-14 17:27 UTC (permalink / raw)
  To: H . J . Lu; +Cc: linux-mips


> > I believe this would break certain pieces of hardware. For example the
> > mq200 framebuffer in the sigmarion is not paged aligned. You have to
> > supply a offset to make it work.
> 
> How do you mmap a memory whose offset is not page aligned? The code
> here is
> 
> return do_mmap2(addr, len, prot, flags, fd, offset >> PAGE_SHIFT);
> 					    ^^^^^^^^^^^^^^^^^^^^
> 
> It is up to the user code to make sure everything is ok.

Sorry. Mix up in the meaning of offset. 

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

end of thread, other threads:[~2001-09-14 17:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-09-14 17:07 PATCH: Fix offset of mmap H . J . Lu
2001-09-14 17:10 ` James Simmons
2001-09-14 17:15   ` H . J . Lu
2001-09-14 17:27     ` James Simmons

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.