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 initialize the fh pointer to NULL when the al...
details: https://anonhg.NetBSD.org/src/rev/8d89f7520abe
branches: trunk
changeset: 796936:8d89f7520abe
user: christos <christos%NetBSD.org@localhost>
date: Thu Jun 26 01:46:03 2014 +0000
description:
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.
diffstat:
sys/kern/vfs_syscalls.c | 11 +++--------
1 files changed, 3 insertions(+), 8 deletions(-)
diffs (53 lines):
diff -r 80ea3f0163df -r 8d89f7520abe sys/kern/vfs_syscalls.c
--- a/sys/kern/vfs_syscalls.c Wed Jun 25 23:22:18 2014 +0000
+++ b/sys/kern/vfs_syscalls.c Thu Jun 26 01:46:03 2014 +0000
@@ -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 @@
{
size_t fhsize;
- if (fhp == NULL) {
- return;
- }
fhsize = FHANDLE_SIZE(fhp);
kmem_free(fhp, fhsize);
}
@@ -1756,7 +1753,6 @@
size_t fidsize;
int error;
- *fhpp = NULL;
mp = vp->v_mount;
fidsize = 0;
error = VFS_VPTOFH(vp, NULL, &fidsize);
@@ -1826,7 +1822,6 @@
fhandle_t *fhp;
int error;
- *fhpp = NULL;
if (fhsize > FHANDLE_SIZE_MAX) {
return EINVAL;
}
@@ -1915,7 +1910,7 @@
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) {
Home |
Main Index |
Thread Index |
Old Index