Skip to contentSkip to conversation

NFS: idmap: handle zero return from nfs_idmap_get_key()

PATCH New [email protected] 1 participant 1 message Nov 12

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 NFS: idmap: handle zero return from nfs_idmap_get_key()

From: Mohammad Shahid <[email protected]>

nfs_idmap_get_key() can return zero, but nfs_idmap_lookup_name() treats only negative values as errors.

Treat zero as an error to avoid reporting an unsuccessful lookup as successful.

---
 fs/nfs/nfs4idmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfs/nfs4idmap.c +1 -1
index 06b193722660..8f5f0abf804d 100644
@@ -353,7 +353,7 @@ static ssize_t nfs_idmap_lookup_name(__u32 id, const char *type, char *buf,
 
 	id_len = nfs_map_numeric_to_string(id, id_str, sizeof(id_str));
 	ret = nfs_idmap_get_key(id_str, id_len, type, buf, buflen, idmap);
-	if (ret < 0)
+	if (ret <= 0)
 		return -EINVAL;
 	return ret;
 }
Signature · 1 line
2.43.0