Browse Source

knfsd: fix broken length check in nfs4idmap.c

Obviously at some point we thought "error" represented the length when
positive.  This appears to be a long-standing typo.

Thanks to Prasad Potluri <pvp@us.ibm.com> for finding the problem and
proposing an earlier version of this patch.

Cc: Steve French <smfltc@us.ibm.com>
Cc: Prasad V Potluri <pvp@us.ibm.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
J. Bruce Fields 17 years ago
parent
commit
d4395e03fe
1 changed files with 3 additions and 6 deletions
  1. 3 6
      fs/nfsd/nfs4idmap.c

+ 3 - 6
fs/nfsd/nfs4idmap.c

@@ -255,13 +255,10 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
 		goto out;
 		goto out;
 	if (len == 0)
 	if (len == 0)
 		set_bit(CACHE_NEGATIVE, &ent.h.flags);
 		set_bit(CACHE_NEGATIVE, &ent.h.flags);
-	else {
-		if (error >= IDMAP_NAMESZ) {
-			error = -EINVAL;
-			goto out;
-		}
+	else if (len >= IDMAP_NAMESZ)
+		goto out;
+	else
 		memcpy(ent.name, buf1, sizeof(ent.name));
 		memcpy(ent.name, buf1, sizeof(ent.name));
-	}
 	error = -ENOMEM;
 	error = -ENOMEM;
 	res = idtoname_update(&ent, res);
 	res = idtoname_update(&ent, res);
 	if (res == NULL)
 	if (res == NULL)