aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/super.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/super.c')
-rw-r--r--fs/nfs/super.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/fs/nfs/super.c b/fs/nfs/super.c
index 330c3922739f..a3492d6f8f9b 100644
--- a/fs/nfs/super.c
+++ b/fs/nfs/super.c
@@ -1648,21 +1648,16 @@ static int nfs4_validate_mount_data(void *options,
1648 len = c - dev_name; 1648 len = c - dev_name;
1649 if (len > NFS4_MAXNAMLEN) 1649 if (len > NFS4_MAXNAMLEN)
1650 return -ENAMETOOLONG; 1650 return -ENAMETOOLONG;
1651 args->nfs_server.hostname = kzalloc(len, GFP_KERNEL); 1651 /* N.B. caller will free nfs_server.hostname in all cases */
1652 if (args->nfs_server.hostname == NULL) 1652 args->nfs_server.hostname = kstrndup(dev_name, len, GFP_KERNEL);
1653 return -ENOMEM;
1654 strncpy(args->nfs_server.hostname, dev_name, len - 1);
1655 1653
1656 c++; /* step over the ':' */ 1654 c++; /* step over the ':' */
1657 len = strlen(c); 1655 len = strlen(c);
1658 if (len > NFS4_MAXPATHLEN) 1656 if (len > NFS4_MAXPATHLEN)
1659 return -ENAMETOOLONG; 1657 return -ENAMETOOLONG;
1660 args->nfs_server.export_path = kzalloc(len + 1, GFP_KERNEL); 1658 args->nfs_server.export_path = kstrndup(c, len, GFP_KERNEL);
1661 if (args->nfs_server.export_path == NULL)
1662 return -ENOMEM;
1663 strncpy(args->nfs_server.export_path, c, len);
1664 1659
1665 dprintk("MNTPATH: %s\n", args->nfs_server.export_path); 1660 dprintk("NFS: MNTPATH: '%s'\n", args->nfs_server.export_path);
1666 1661
1667 if (args->client_address == NULL) 1662 if (args->client_address == NULL)
1668 goto out_no_client_address; 1663 goto out_no_client_address;