summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfsclient/nfs_clvfsops.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/fs/nfsclient/nfs_clvfsops.c')
-rw-r--r--sys/fs/nfsclient/nfs_clvfsops.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/sys/fs/nfsclient/nfs_clvfsops.c b/sys/fs/nfsclient/nfs_clvfsops.c
index b062d2c..8dc5b0b 100644
--- a/sys/fs/nfsclient/nfs_clvfsops.c
+++ b/sys/fs/nfsclient/nfs_clvfsops.c
@@ -1079,15 +1079,21 @@ nfs_mount(struct mount *mp)
dirpath[0] = '\0';
dirlen = strlen(dirpath);
- if (has_nfs_args_opt == 0 && vfs_getopt(mp->mnt_optnew, "addr",
- (void **)&args.addr, &args.addrlen) == 0) {
- if (args.addrlen > SOCK_MAXADDRLEN) {
- error = ENAMETOOLONG;
+ if (has_nfs_args_opt == 0) {
+ if (vfs_getopt(mp->mnt_optnew, "addr",
+ (void **)&args.addr, &args.addrlen) == 0) {
+ if (args.addrlen > SOCK_MAXADDRLEN) {
+ error = ENAMETOOLONG;
+ goto out;
+ }
+ nam = malloc(args.addrlen, M_SONAME, M_WAITOK);
+ bcopy(args.addr, nam, args.addrlen);
+ nam->sa_len = args.addrlen;
+ } else {
+ vfs_mount_error(mp, "No server address");
+ error = EINVAL;
goto out;
}
- nam = malloc(args.addrlen, M_SONAME, M_WAITOK);
- bcopy(args.addr, nam, args.addrlen);
- nam->sa_len = args.addrlen;
}
args.fh = nfh;
OpenPOWER on IntegriCloud