mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: mdshahid03@gmail.com
To: trondmy@kernel.org
Cc: anna@kernel.org, linux-nfs@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	Mohammad Shahid <mdshahid03@gmail.com>
Subject: [PATCH v2] NFS: idmap: handle zero return from nfs_idmap_get_key()
Date: Thu, 12 Nov 2026 21:59:38 +0530	[thread overview]
Message-ID: <20261112162938.14329-1-mdshahid03@gmail.com> (raw)

From: Mohammad Shahid <mdshahid03@gmail.com>

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.

Signed-off-by: Mohammad Shahid <mdshahid03@gmail.com>
---
 fs/nfs/nfs4idmap.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4idmap.c b/fs/nfs/nfs4idmap.c
index 06b193722660..8f5f0abf804d 100644
--- a/fs/nfs/nfs4idmap.c
+++ b/fs/nfs/nfs4idmap.c
@@ -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;
 }
-- 
2.43.0


                 reply	other threads:[~2026-11-12 16:30 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261112162938.14329-1-mdshahid03@gmail.com \
    --to=mdshahid03@gmail.com \
    --cc=anna@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®