NFSD: Fix bad using of return value from qword_get
authorKinglong Mee <kinglongmee@gmail.com>
Tue, 2 Sep 2014 14:13:32 +0000 (22:13 +0800)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 3 Sep 2014 21:43:02 +0000 (17:43 -0400)
Signed-off-by: Kinglong Mee <kinglongmee@gmail.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4idmap.c

index a0ab0a847d6933c2f9e8c90a95465749e65abe93..dc948f667650f51419fbafdafe8383353b10fb66 100644 (file)
@@ -368,7 +368,7 @@ nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
 {
        struct ent ent, *res;
        char *buf1;
-       int error = -EINVAL;
+       int len, error = -EINVAL;
 
        if (buf[buflen - 1] != '\n')
                return (-EINVAL);
@@ -392,8 +392,8 @@ nametoid_parse(struct cache_detail *cd, char *buf, int buflen)
                IDMAP_TYPE_USER : IDMAP_TYPE_GROUP;
 
        /* Name */
-       error = qword_get(&buf, buf1, PAGE_SIZE);
-       if (error <= 0 || error >= IDMAP_NAMESZ)
+       len = qword_get(&buf, buf1, PAGE_SIZE);
+       if (len <= 0 || len >= IDMAP_NAMESZ)
                goto out;
        memcpy(ent.name, buf1, sizeof(ent.name));