Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Don't inspect vn_stat() results until after checkin...



details:   https://anonhg.NetBSD.org/src/rev/6ddb4749d8bd
branches:  trunk
changeset: 752127:6ddb4749d8bd
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue Feb 16 05:47:52 2010 +0000

description:
Don't inspect vn_stat() results until after checking that it succeeded.
If anyone's been seeing random "File too large" results from module loading,
this should fix it.

diffstat:

 sys/kern/kern_module_vfs.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (32 lines):

diff -r 79ddfd43d48c -r 6ddb4749d8bd sys/kern/kern_module_vfs.c
--- a/sys/kern/kern_module_vfs.c        Tue Feb 16 02:46:02 2010 +0000
+++ b/sys/kern/kern_module_vfs.c        Tue Feb 16 05:47:52 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kern_module_vfs.c,v 1.2 2010/01/19 22:17:44 pooka Exp $        */
+/*     $NetBSD: kern_module_vfs.c,v 1.3 2010/02/16 05:47:52 dholland Exp $     */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.2 2010/01/19 22:17:44 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_module_vfs.c,v 1.3 2010/02/16 05:47:52 dholland Exp $");
 
 #define _MODULE_INTERNAL
 #include <sys/param.h>
@@ -153,10 +153,11 @@
        }
 
        error = vn_stat(nd.ni_vp, &sb);
+       if (error != 0) {
+               goto out1;
+       }
        if (sb.st_size >= (plistsize - 1)) {    /* leave space for term \0 */
                error = EFBIG;
-       }
-       if (error != 0) {
                goto out1;
        }
 



Home | Main Index | Thread Index | Old Index