mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] NFS: idmap: handle zero return from nfs_idmap_get_key()
@ 2026-11-12 16:29 mdshahid03
  2026-11-24 13:09 ` mdshahid03
  0 siblings, 1 reply; 2+ messages in thread
From: mdshahid03 @ 2026-11-12 16:29 UTC (permalink / raw)
  To: trondmy; +Cc: anna, linux-nfs, linux-kernel, Mohammad Shahid

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] NFS: idmap: handle zero return from nfs_idmap_get_key()
  2026-11-12 16:29 [PATCH v2] NFS: idmap: handle zero return from nfs_idmap_get_key() mdshahid03
@ 2026-11-24 13:09 ` mdshahid03
  0 siblings, 0 replies; 2+ messages in thread
From: mdshahid03 @ 2026-11-24 13:09 UTC (permalink / raw)
  To: mdshahid03; +Cc: trondmy, anna, linux-nfs, linux-kernel

Hi ,

Could you please check and give your feedback ? when time permits.

Thanks
Shahid.

On 2026-11-12 21:59 +0530, mdshahid03@gmail.com wrote:
> 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
> 
> 
> 



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-24 13:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-12 16:29 [PATCH v2] NFS: idmap: handle zero return from nfs_idmap_get_key() mdshahid03
2026-11-24 13:09 ` mdshahid03

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®