diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index fbec149ca52..13a0ed1cee2 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -643,6 +643,8 @@ freebsd4_getfsstat(td, uap) size = count * sizeof(struct statfs); error = kern_getfsstat(td, &buf, size, &count, UIO_SYSSPACE, uap->mode); + if (buf == NULL) + return (EINVAL); td->td_retval[0] = count; if (size != 0) { sp = buf;