Module Name: src Committed By: christos Date: Thu Jun 26 01:46:03 UTC 2014
Modified Files: src/sys/kern: vfs_syscalls.c Log Message: Don't initialize the fh pointer to NULL when the allocation functions fail and allow NULL in the free functions. It just leads to writing sloppy code for no good reason. To generate a diff of this commit: cvs rdiff -u -r1.484 -r1.485 src/sys/kern/vfs_syscalls.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/kern/vfs_syscalls.c diff -u src/sys/kern/vfs_syscalls.c:1.484 src/sys/kern/vfs_syscalls.c:1.485 --- src/sys/kern/vfs_syscalls.c:1.484 Sat Jun 14 07:37:35 2014 +++ src/sys/kern/vfs_syscalls.c Wed Jun 25 21:46:03 2014 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.484 2014/06/14 11:37:35 njoly Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.485 2014/06/26 01:46:03 christos Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -70,7 +70,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.484 2014/06/14 11:37:35 njoly Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.485 2014/06/26 01:46:03 christos Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -1706,9 +1706,6 @@ vfs__fhfree(fhandle_t *fhp) { size_t fhsize; - if (fhp == NULL) { - return; - } fhsize = FHANDLE_SIZE(fhp); kmem_free(fhp, fhsize); } @@ -1756,7 +1753,6 @@ vfs_composefh_alloc(struct vnode *vp, fh size_t fidsize; int error; - *fhpp = NULL; mp = vp->v_mount; fidsize = 0; error = VFS_VPTOFH(vp, NULL, &fidsize); @@ -1826,7 +1822,6 @@ vfs_copyinfh_alloc(const void *ufhp, siz fhandle_t *fhp; int error; - *fhpp = NULL; if (fhsize > FHANDLE_SIZE_MAX) { return EINVAL; } @@ -1915,7 +1910,7 @@ sys___getfh30(struct lwp *l, const struc error = vfs_composefh_alloc(vp, &fh); vput(vp); if (error != 0) { - goto out; + return error; } error = copyin(SCARG(uap, fh_size), &usz, sizeof(size_t)); if (error != 0) {