提交 c7c545d4 编写于 作者: D Dan Carpenter 提交者: 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: NDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: NTrond Myklebust <trond.myklebust@primarydata.com>
上级 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% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册