Commit c7c545d4 authored by Dan Carpenter's avatar Dan Carpenter Committed by Trond Myklebust

NFS: a couple off by ones

These tests are off by one because if len == sizeof(nfs_export_path)
then we have truncated the name.
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 3a7ed3ff
...@@ -261,11 +261,11 @@ static int __init root_nfs_data(char *cmdline) ...@@ -261,11 +261,11 @@ static int __init root_nfs_data(char *cmdline)
*/ */
len = snprintf(nfs_export_path, sizeof(nfs_export_path), len = snprintf(nfs_export_path, sizeof(nfs_export_path),
tmp, utsname()->nodename); tmp, utsname()->nodename);
if (len > (int)sizeof(nfs_export_path)) if (len >= (int)sizeof(nfs_export_path))
goto out_devnametoolong; goto out_devnametoolong;
len = snprintf(nfs_root_device, sizeof(nfs_root_device), len = snprintf(nfs_root_device, sizeof(nfs_root_device),
"%pI4:%s", &servaddr, nfs_export_path); "%pI4:%s", &servaddr, nfs_export_path);
if (len > (int)sizeof(nfs_root_device)) if (len >= (int)sizeof(nfs_root_device))
goto out_devnametoolong; goto out_devnametoolong;
retval = 0; retval = 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment