diff mbox series

[-next] UNRPC: Return specific error code on kmalloc failure

Message ID 1631266404-29698-1-git-send-email-yang.lee@linux.alibaba.com (mailing list archive)
State Deferred
Delegated to: Netdev Maintainers
Headers show
Series [-next] UNRPC: Return specific error code on kmalloc failure | expand

Checks

Context Check Description
netdev/cover_letter success Link
netdev/fixes_present success Link
netdev/patch_count success Link
netdev/tree_selection success Guessed tree name to be net-next
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cc_maintainers warning 3 maintainers not CCed: linux-nfs@vger.kernel.org colin.king@canonical.com martijn.de.gouw@prodrive-technologies.com
netdev/source_inline success Was 0 now: 0
netdev/verify_signedoff success Link
netdev/module_param success Was 0 now: 0
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/verify_fixes success Link
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/header_inline success Link

Commit Message

Yang Li Sept. 10, 2021, 9:33 a.m. UTC
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(-)

Comments

J. Bruce Fields Sept. 23, 2021, 8:05 p.m. UTC | #1
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
diff mbox series

Patch

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;