From owner-p4-projects@FreeBSD.ORG Tue Jun 27 20:58:01 2006 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 367FF16A71F; Tue, 27 Jun 2006 20:58:01 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id EDC5D16A71B for ; Tue, 27 Jun 2006 20:58:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [216.136.204.115]) by mx1.FreeBSD.org (Postfix) with ESMTP id 399EF43E38 for ; Tue, 27 Jun 2006 20:57:58 +0000 (GMT) (envelope-from jhb@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id k5RKvu7Z004829 for ; Tue, 27 Jun 2006 20:57:56 GMT (envelope-from jhb@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id k5RKvudR004826 for perforce@freebsd.org; Tue, 27 Jun 2006 20:57:56 GMT (envelope-from jhb@freebsd.org) Date: Tue, 27 Jun 2006 20:57:56 GMT Message-Id: <200606272057.k5RKvudR004826@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to jhb@freebsd.org using -f From: John Baldwin To: Perforce Change Reviews Cc: Subject: PERFORCE change 100172 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Jun 2006 20:58:01 -0000 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);