From: kanoj@google.engr.sgi.com (Kanoj Sarcar)
To: linux-mm@kvack.org
Subject: [PATCH] kanoj-mm25-2.3.26 Fix max_mapnr<<PAGE_SHIFT overflows
Date: Mon, 8 Nov 1999 19:12:28 -0800 (PST) [thread overview]
Message-ID: <199911090312.TAA17636@google.engr.sgi.com> (raw)
This has already been sent to Linus to be included into 2.3.27.
Kanoj
Linus,
Now that >4Gb memory support is possible, it is no longer true that
(max_mapnr << PAGE_SHIFT) can be held within a 32 bit unsigned long.
This patch tries to fix this overflow problem.
Please put into 2.3.27. Thanks.
Kanoj
--- /usr/tmp/p_rdiff_a006_p/dir.c Mon Nov 8 17:30:59 1999
+++ fs/ncpfs/dir.c Mon Nov 8 16:10:42 1999
@@ -405,7 +405,6 @@
{
unsigned long dent_addr = (unsigned long) dentry;
unsigned long min_addr = PAGE_OFFSET;
- unsigned long max_addr = min_addr + (max_mapnr << PAGE_SHIFT);
unsigned long align_mask = 0x0F;
unsigned int len;
int valid = 0;
@@ -412,7 +411,7 @@
if (dent_addr < min_addr)
goto bad_addr;
- if (dent_addr > max_addr - sizeof(struct dentry))
+ if (dent_addr > (unsigned long)high_memory - sizeof(struct dentry))
goto bad_addr;
if ((dent_addr & ~align_mask) != dent_addr)
goto bad_align;
--- /usr/tmp/p_rdiff_a006_z/kcore.c Mon Nov 8 17:31:18 1999
+++ fs/proc/kcore.c Mon Nov 8 16:10:42 1999
@@ -20,7 +20,7 @@
ssize_t read_kcore(struct file * file, char * buf,
size_t count, loff_t *ppos)
{
- unsigned long p = *ppos, memsize;
+ unsigned long long p = *ppos, memsize;
ssize_t read;
ssize_t count1;
char * pnt;
--- /usr/tmp/p_rdiff_a006-8/vmalloc.c Mon Nov 8 17:31:44 1999
+++ mm/vmalloc.c Mon Nov 8 16:10:42 1999
@@ -204,7 +204,7 @@
struct vm_struct *area;
size = PAGE_ALIGN(size);
- if (!size || size > (max_mapnr << PAGE_SHIFT)) {
+ if (!size || ((PAGE_ALIGN(size) >> PAGE_SHIFT) > max_mapnr)) {
BUG();
return NULL;
}
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://humbolt.geo.uu.nl/Linux-MM/
reply other threads:[~1999-11-09 3:12 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=199911090312.TAA17636@google.engr.sgi.com \
--to=kanoj@google.engr.sgi.com \
--cc=linux-mm@kvack.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