From: Gerhard Jaeger <g.jaeger@sysgo.com>
To: linuxppc-dev@ozlabs.org
Subject: do_mmap_pgoff issue...
Date: Thu, 27 Apr 2006 15:59:19 +0200 [thread overview]
Message-ID: <200604271559.19818.g.jaeger@sysgo.com> (raw)
Hi list,
while trying to mmap some flash area on my mpc8541 CDS board,
I noticed that the overflow case is probably not correctly handled
within function do_mmap_pgoff in linux/mm/mmap.c
The facts:
- mmap the last page @ 0xFFFFF000, len 4K
- result: mmap says EOVERFLOW...
- the function that failed was do_mmap_pgoff()
Here's the pice of code
/* offset overflow? */
if ((pgoff + (len >> PAGE_SHIFT)) < pgoff)
return -EOVERFLOW;
It's quite clear why it fails in my case:
pgoff + (len >> PAGE_SHIFT) will be 0
I fixed that by inserting the following, to handle that special case:
if ((pgoff + (len >> PAGE_SHIFT)) < pgoff) {
if ((pgoff + (len >> PAGE_SHIFT)) != 0 )
return -EOVERFLOW;
}
My question is - is that behaviour a bug or a feature? In fact it's
an off-by-one issue, but I could not believe, that nobody else ever
had problems with that.
TIA for enlighten me
Gerhard
--
Gerhard Jaeger <gjaeger@sysgo.com>
SYSGO AG Embedded and Real-Time Software
www.sysgo.com | www.elinos.com | www.pikeos.com | www.osek.de
next reply other threads:[~2006-04-27 14:24 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-04-27 13:59 Gerhard Jaeger [this message]
2006-04-27 22:47 ` do_mmap_pgoff issue Paul Mackerras
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=200604271559.19818.g.jaeger@sysgo.com \
--to=g.jaeger@sysgo.com \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).