Re: can't allocate kernel memory for module

Chris Wedgwood (chris@cybernet.co.nz)
Wed, 22 Jul 1998 01:29:36 +1200


--1LKvkjL3sHcu1TtY
Content-Type: text/plain; charset=us-ascii

I posted a fix for this earlier. Message attached below.

-cw

--1LKvkjL3sHcu1TtY
Content-Type: message/rfc822
Content-Description: Forwarded message from Chris Wedgwood <chris@cybernet.co.nz>

Message-ID: <19980722003616.A148@caffeine.ix.net.nz>
Date: Wed, 22 Jul 1998 00:36:16 +1200
From: Chris Wedgwood <chris@cybernet.co.nz>
To: Craig Schlenter <craig@is.co.za>, linux-kernel@vger.rutgers.edu
Cc: Linus Torvalds <torvalds@transmeta.com>
Subject: [Partial fix] Re: Problems with memory in .110
References: <Pine.LNX.3.96.980721115325.417A-100000@flashy.is.co.za>
Mime-Version: 1.0
Content-Type: multipart/mixed; boundary=kORqDWCi7qDJ0mEj
X-Mailer: Mutt 0.93.1i
In-Reply-To: <Pine.LNX.3.96.980721115325.417A-100000@flashy.is.co.za>; from Craig Schlenter on Tue, Jul 21, 1998 at 12:01:00PM +0200
X-No-Archive: Yes

--kORqDWCi7qDJ0mEj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=mutta00148

Its a problem with linux/mm/vmalloc.c

Back out (patch -R) that hunk from the patch and all is happy again (hunk
attached for convenience).

I'll make a real fix soon and post it, only I want to test it this time (see
previous messages).

-cw

--kORqDWCi7qDJ0mEj
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=module-mem-fix-1

--- v2.1.109/linux/mm/vmalloc.c Tue Jun 23 10:01:30 1998
+++ linux/mm/vmalloc.c Mon Jul 20 14:00:06 1998
@@ -152,19 +152,21 @@

struct vm_struct * get_vm_area(unsigned long size)
{
- void *addr;
+ unsigned long addr;
struct vm_struct **p, *tmp, *area;

area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
if (!area)
return NULL;
- addr = (void *) VMALLOC_START;
+ addr = VMALLOC_START;
for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
- if (size + (unsigned long) addr < (unsigned long) tmp->addr)
+ if (size + addr < (unsigned long) tmp->addr)
break;
- addr = (void *) (tmp->size + (unsigned long) tmp->addr);
+ if (addr > VMALLOC_END-size)
+ return NULL;
+ addr = tmp->size + (unsigned long) tmp->addr;
}
- area->addr = addr;
+ area->addr = (void *)addr;
area->size = size + PAGE_SIZE;
area->next = *p;
*p = area;

--kORqDWCi7qDJ0mEj--

--1LKvkjL3sHcu1TtY--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.altern.org/andrebalsa/doc/lkml-faq.html