Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/roland...
[powerpc.git] / fs / nfsd / nfs4idmap.c
index 2cf9a9a..4c0c683 100644 (file)
@@ -138,7 +138,7 @@ idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
        char idstr[11];
 
        qword_add(bpp, blen, ent->authname);
-       snprintf(idstr, sizeof(idstr), "%d", ent->id);
+       snprintf(idstr, sizeof(idstr), "%u", ent->id);
        qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user");
        qword_add(bpp, blen, idstr);
 
@@ -165,7 +165,7 @@ idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
                return 0;
        }
        ent = container_of(h, struct ent, h);
-       seq_printf(m, "%s %s %d", ent->authname,
+       seq_printf(m, "%s %s %u", ent->authname,
                        ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
                        ent->id);
        if (test_bit(CACHE_VALID, &h->flags))
@@ -207,6 +207,7 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
 {
        struct ent ent, *res;
        char *buf1, *bp;
+       int len;
        int error = -EINVAL;
 
        if (buf[buflen - 1] != '\n')
@@ -248,10 +249,11 @@ idtoname_parse(struct cache_detail *cd, char *buf, int buflen)
                goto out;
 
        /* Name */
-       error = qword_get(&buf, buf1, PAGE_SIZE);
-       if (error == -EINVAL)
+       error = -EINVAL;
+       len = qword_get(&buf, buf1, PAGE_SIZE);
+       if (len < 0)
                goto out;
-       if (error == -ENOENT)
+       if (len == 0)
                set_bit(CACHE_NEGATIVE, &ent.h.flags);
        else {
                if (error >= IDMAP_NAMESZ) {
@@ -349,7 +351,7 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
                        ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
                        ent->name);
        if (test_bit(CACHE_VALID, &h->flags))
-               seq_printf(m, " %d", ent->id);
+               seq_printf(m, " %u", ent->id);
        seq_printf(m, "\n");
        return 0;
 }