diff -urNp 2.4.19pre9ac1/mm/mmap.c 2.4.19pre9ac2/mm/mmap.c --- 2.4.19pre9ac1/mm/mmap.c Thu May 30 16:08:06 2002 +++ 2.4.19pre9ac2/mm/mmap.c Thu May 30 18:07:50 2002 @@ -485,6 +485,12 @@ static int vma_merge(struct mm_struct * return 0; } + +/* + * NOTE: in this function we rely on TASK_SIZE being lower than + * SIZE_MAX-PAGE_SIZE at least. I'm pretty sure that it is. + */ + unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, unsigned long len, unsigned long prot, unsigned long flags, unsigned long pgoff) { @@ -500,12 +506,14 @@ unsigned long do_mmap_pgoff(struct file if (file && (!file->f_op || !file->f_op->mmap)) return -ENODEV; - if ((len = PAGE_ALIGN(len)) == 0) + if (!len) return addr; if (len > TASK_SIZE) return -EINVAL; + len = PAGE_ALIGN(len); /* This cannot be zero now */ + /* offset overflow? */ if ((pgoff + (len >> PAGE_SHIFT)) < pgoff) return -EINVAL;