Netdev Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH -next] UNRPC: Return specific error code on kmalloc failure
@ 2021-09-10  9:33 Yang Li
  2021-09-23 20:05 ` J. Bruce Fields
  0 siblings, 1 reply; 2+ messages in thread
From: Yang Li @ 2021-09-10  9:33 UTC (permalink / raw)
  To: kuba
  Cc: davem, anna.schumaker, trond.myklebust, chuck.lever, bfields,
	netdev, linux-kernel, Yang Li

Although the callers of this function only care about whether the
return value is null or not, we should still give a rigorous
error code.

Smatch tool warning:
net/sunrpc/auth_gss/svcauth_gss.c:784 gss_write_verf() warn: returning
-1 instead of -ENOMEM is sloppy

No functional change, just more standardized.

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
---
 net/sunrpc/auth_gss/svcauth_gss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 3e776e3..7dba6a9 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -781,7 +781,7 @@ static inline u32 round_up_to_quad(u32 i)
 	svc_putnl(rqstp->rq_res.head, RPC_AUTH_GSS);
 	xdr_seq = kmalloc(4, GFP_KERNEL);
 	if (!xdr_seq)
-		return -1;
+		return -ENOMEM;
 	*xdr_seq = htonl(seq);
 
 	iov.iov_base = xdr_seq;
-- 
1.8.3.1


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

* Re: [PATCH -next] UNRPC: Return specific error code on kmalloc failure
  2021-09-10  9:33 [PATCH -next] UNRPC: Return specific error code on kmalloc failure Yang Li
@ 2021-09-23 20:05 ` J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: J. Bruce Fields @ 2021-09-23 20:05 UTC (permalink / raw)
  To: Yang Li
  Cc: kuba, davem, anna.schumaker, trond.myklebust, chuck.lever,
	netdev, linux-kernel

On Fri, Sep 10, 2021 at 05:33:24PM +0800, Yang Li wrote:
> Although the callers of this function only care about whether the
> return value is null or not, we should still give a rigorous
> error code.

Eh, I'm not sure I understand why this is important but, OK,
applying.--b.

> 
> Smatch tool warning:
> net/sunrpc/auth_gss/svcauth_gss.c:784 gss_write_verf() warn: returning
> -1 instead of -ENOMEM is sloppy
> 
> No functional change, just more standardized.
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Signed-off-by: Yang Li <yang.lee@linux.alibaba.com>
> ---
>  net/sunrpc/auth_gss/svcauth_gss.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
> index 3e776e3..7dba6a9 100644
> --- a/net/sunrpc/auth_gss/svcauth_gss.c
> +++ b/net/sunrpc/auth_gss/svcauth_gss.c
> @@ -781,7 +781,7 @@ static inline u32 round_up_to_quad(u32 i)
>  	svc_putnl(rqstp->rq_res.head, RPC_AUTH_GSS);
>  	xdr_seq = kmalloc(4, GFP_KERNEL);
>  	if (!xdr_seq)
> -		return -1;
> +		return -ENOMEM;
>  	*xdr_seq = htonl(seq);
>  
>  	iov.iov_base = xdr_seq;
> -- 
> 1.8.3.1

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

end of thread, other threads:[~2021-09-23 20:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-10  9:33 [PATCH -next] UNRPC: Return specific error code on kmalloc failure Yang Li
2021-09-23 20:05 ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).