Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Jun 2006 20:57:56 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 100172 for review
Message-ID:  <200606272057.k5RKvudR004826@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=100172

Change 100172 by jhb@jhb_mutex on 2006/06/27 20:56:57

	Do cheap error checking sooner.

Affected files ...

.. //depot/projects/smpng/sys/compat/linux/linux_file.c#30 edit

Differences ...

==== //depot/projects/smpng/sys/compat/linux/linux_file.c#30 (text+ko) ====

@@ -261,6 +261,16 @@
 	u_long *cookies = NULL, *cookiep;
 	int ncookies, vfslocked;
 
+	nbytes = args->count;
+	if (nbytes == 1) {
+		/* readdir(2) case. Always struct dirent. */
+		if (is64bit)
+			return (EINVAL);
+		nbytes = sizeof(linux_dirent);
+		justone = 1;
+	} else
+		justone = 0;
+
 	if ((error = getvnode(td->td_proc->p_fd, args->fd, &fp)) != 0)
 		return (error);
 
@@ -277,19 +287,6 @@
 		return (EINVAL);
 	}
 
-	nbytes = args->count;
-	if (nbytes == 1) {
-		/* readdir(2) case. Always struct dirent. */
-		if (is64bit) {
-			VFS_UNLOCK_GIANT(vfslocked);
-			fdrop(fp, td);
-			return (EINVAL);
-		}
-		nbytes = sizeof(linux_dirent);
-		justone = 1;
-	} else
-		justone = 0;
-
 	off = fp->f_offset;
 
 	buflen = max(LINUX_DIRBLKSIZ, nbytes);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200606272057.k5RKvudR004826>