netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Yang Li <yang.lee@linux.alibaba.com>
Cc: kuba@kernel.org, davem@davemloft.net, anna.schumaker@netapp.com,
	trond.myklebust@hammerspace.com, chuck.lever@oracle.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH -next] UNRPC: Return specific error code on kmalloc failure
Date: Thu, 23 Sep 2021 16:05:06 -0400	[thread overview]
Message-ID: <20210923200506.GF18334@fieldses.org> (raw)
In-Reply-To: <1631266404-29698-1-git-send-email-yang.lee@linux.alibaba.com>

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

      reply	other threads:[~2021-09-23 20:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=20210923200506.GF18334@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=anna.schumaker@netapp.com \
    --cc=chuck.lever@oracle.com \
    --cc=davem@davemloft.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=yang.lee@linux.alibaba.com \
    /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;
as well as URLs for NNTP newsgroup(s).