lkml.org 
[lkml]   [2002]   [Feb]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ioremap()/PCI sickness in 2.4.18-rc2 (FIXED ALMOST)
"Jeff V. Merkey" wrote:
>
> On Wed, Feb 20, 2002 at 02:54:49PM -0700, Jeff V. Merkey wrote:
>
> > struct vm_struct * get_vm_area(unsigned long size, unsigned long flags)
> > {
> > unsigned long addr;
> > struct vm_struct **p, *tmp, *area;
> >
> > area = (struct vm_struct *) kmalloc(sizeof(*area), GFP_KERNEL);
> > if (!area)
> > return NULL;
> > size += PAGE_SIZE;
> > addr = VMALLOC_START;
> > write_lock(&vmlist_lock);
> > for (p = &vmlist; (tmp = *p) ; p = &tmp->next) {
> >
> > ===============> we barf here since the size + addr wraps
> >
>
> Also, this function should be moved to the /arch/i386/mm area since
> it is doing pointer arithmetic with 32 bit assumptions (i.e.
> unsigned long + unsigned long) Last time I checked, unsigned long
> was a construct for a 32 bit value in any gcc compiler version, ia64
> or not.
>

Jeff,

I think you'll have to check again. In LP64 programming models (used on most
64-bit OS'es) 'long' is 64 bit. Thus a 'unsigned long' is always safe to use
for pointer arithmetic since it will be 32 bit on 32bit machines and 64bit on
64bit machines.

Regards,
--
Steffen Persvold | Scalable Linux Systems | Try out the world's best
mailto:sp@scali.com | http://www.scali.com | performing MPI implementation:
Tel: (+47) 2262 8950 | Olaf Helsets vei 6 | - ScaMPI 1.13.8 -
Fax: (+47) 2262 8951 | N0621 Oslo, NORWAY | >320MBytes/s and <4uS latency
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 13:24    [from the cache]
©2003-2011 Jasper Spaans. Advertise on this site