NFS: Use sizeof() instead of strlen() on string constants. Signed-off-by: Trond Myklebust --- dir.c | 2 +- nfsroot.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) Index: linux-2.6.11-rc3-up/fs/nfs/nfsroot.c =================================================================== --- linux-2.6.11-rc3-up.orig/fs/nfs/nfsroot.c +++ linux-2.6.11-rc3-up/fs/nfs/nfsroot.c @@ -385,9 +385,9 @@ int __init nfs_root_setup(char *line) if (line[0] == '/' || line[0] == ',' || (line[0] >= '0' && line[0] <= '9')) { strlcpy(nfs_root_name, line, sizeof(nfs_root_name)); } else { - int n = strlen(line) + strlen(NFS_ROOT); + int n = strlen(line) + sizeof(NFS_ROOT) - 1; 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); } root_server_addr = root_nfs_parse_addr(nfs_root_name); Index: linux-2.6.11-rc3-up/fs/nfs/dir.c =================================================================== --- linux-2.6.11-rc3-up.orig/fs/nfs/dir.c +++ linux-2.6.11-rc3-up/fs/nfs/dir.c @@ -1107,7 +1107,7 @@ static int nfs_sillyrename(struct inode static unsigned int sillycounter; const int i_inosize = sizeof(dir->i_ino)*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]; struct qstr qsilly; struct dentry *sdentry;