Commit 2f8416db authored by Trond Myklebust's avatar Trond Myklebust

NFS: Use sizeof() instead of strlen() on string constants.

Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent bb13f3d0
...@@ -1107,7 +1107,7 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry) ...@@ -1107,7 +1107,7 @@ static int nfs_sillyrename(struct inode *dir, struct dentry *dentry)
static unsigned int sillycounter; static unsigned int sillycounter;
const int i_inosize = sizeof(dir->i_ino)*2; const int i_inosize = sizeof(dir->i_ino)*2;
const int countersize = sizeof(sillycounter)*2; const int countersize = sizeof(sillycounter)*2;
const int slen = strlen(".nfs") + i_inosize + countersize; const int slen = sizeof(".nfs") + i_inosize + countersize - 1;
char silly[slen+1]; char silly[slen+1];
struct qstr qsilly; struct qstr qsilly;
struct dentry *sdentry; struct dentry *sdentry;
......
...@@ -385,9 +385,9 @@ int __init nfs_root_setup(char *line) ...@@ -385,9 +385,9 @@ int __init nfs_root_setup(char *line)
if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) { if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) {
strlcpy(nfs_root_name, line, sizeof(nfs_root_name)); strlcpy(nfs_root_name, line, sizeof(nfs_root_name));
} else { } else {
int n = strlen(line) + strlen(NFS_ROOT); int n = strlen(line) + sizeof(NFS_ROOT) - 1;
if (n >= sizeof(nfs_root_name)) if (n >= sizeof(nfs_root_name))
line[sizeof(nfs_root_name) - strlen(NFS_ROOT) - 1] = '\0'; line[sizeof(nfs_root_name) - sizeof(NFS_ROOT) - 2] = '\0';
sprintf(nfs_root_name, NFS_ROOT, line); sprintf(nfs_root_name, NFS_ROOT, line);
} }
root_server_addr = root_nfs_parse_addr(nfs_root_name); root_server_addr = root_nfs_parse_addr(nfs_root_name);
......
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