patch-2.2.8 linux/arch/arm/kernel/sys_arm.c
Next file: linux/arch/arm/mm/Makefile
Previous file: linux/arch/alpha/math-emu/ieee-math.h
Back to the patch index
Back to the overall index
-  Lines: 17
 -  Date:
Sat May  8 11:14:01 1999
 -  Orig file: 
v2.2.7/linux/arch/arm/kernel/sys_arm.c
 -  Orig date: 
Tue Dec 22 14:16:53 1998
 
diff -u --recursive --new-file v2.2.7/linux/arch/arm/kernel/sys_arm.c linux/arch/arm/kernel/sys_arm.c
@@ -77,12 +77,14 @@
 		goto out;
 	if (!(a.flags & MAP_ANONYMOUS)) {
 		error = -EBADF;
-		if (a.fd >= current->files->max_fds || 
-		    !(file = current->files->fd[a.fd]))
+		file = fget(a.fd);
+		if (!file)
 			goto out;
 	}
 	a.flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
 	error = do_mmap(file, a.addr, a.len, a.prot, a.flags, a.offset);
+	if (file)
+		fput(file);
 out:
 	unlock_kernel();
 	return error;
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)