if ((mm->total_vm << PAGE_SHIFT) + len > current->signal->rlim[RLIMIT_AS].rlim_cur) 
if (!may_expand_vm(mm, len >> PAGE_SHIFT)) 
unsigned long do_brk(unsigned long addr, unsigned long len){	struct mm_struct * mm = current->mm;	struct vm_area_struct * vma, * prev;	unsigned long flags;	struct rb_node ** rb_link, * rb_parent;	pgoff_t pgoff = addr >> PAGE_SHIFT;	len = PAGE_ALIGN(len);	if (!len)		return addr;	if ((addr + len) > TASK_SIZE || (addr + len) < addr)		return -EINVAL;	/*	 * mlock MCL_FUTURE?	 */	if (mm->def_flags & VM_LOCKED) {		unsigned long locked, lock_limit;		locked = mm->locked_vm << PAGE_SHIFT;		lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;		locked += len;		if (locked > lock_limit && !capable(CAP_IPC_LOCK))			return -EAGAIN;	}	/*	 * mm->mmap_sem is required to protect against another thread	 * changing the mappings in case we sleep.	 */	verify_mm_writelocked(mm);	/*	 * Clear old maps.  this also does some error checking for us	 */ munmap_back:	vma = find_vma_prepare(mm, addr, &prev, &rb_link, &rb_parent);	if (vma && vma->vm_start < addr + len) {		if (do_munmap(mm, addr, len))			return -ENOMEM;		goto munmap_back;	}	/* Check against address space limits *after* clearing old maps... */	if ((mm->total_vm << PAGE_SHIFT) + len	    > current->signal->rlim[RLIMIT_AS].rlim_cur)		return -ENOMEM;	if (mm->map_count > sysctl_max_map_count)		return -ENOMEM;	if (security_vm_enough_memory(len >> PAGE_SHIFT))		return -ENOMEM;	flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;	/* Can we just expand an old private anonymous mapping? */	if (vma_merge(mm, prev, addr, addr + len, flags,					NULL, NULL, pgoff, NULL))		goto out;	/*	 * create a vma struct for an anonymous mapping	 */	vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL);	if (!vma) {		vm_unacct_memory(len >> PAGE_SHIFT);		return -ENOMEM;	}	memset(vma, 0, sizeof(*vma));	vma->vm_mm = mm;	vma->vm_start = addr;	vma->vm_end = addr + len;	vma->vm_pgoff = pgoff;	vma->vm_flags = flags;	vma->vm_page_prot = protection_map[flags & 0x0f];	vma_link(mm, vma, prev, rb_link, rb_parent);out:	mm->total_vm += len >> PAGE_SHIFT;	if (flags & VM_LOCKED) {		mm->locked_vm += len >> PAGE_SHIFT;		make_pages_present(addr, addr + len);	}	return addr;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/119f657c72fc07d6fd28c61de59cfba1566970a9/mmap.c/buggy/mm/mmap.c