From: Markus Elfring <Markus.Elfring@web.de>
To: Chuck Lever <chuck.lever@oracle.com>,
linux-nfs@vger.kernel.org, netdev@vger.kernel.org,
kernel-janitors@vger.kernel.org
Cc: Anna Schumaker <anna@kernel.org>,
Ard Biesheuvel <ardb@kernel.org>, Dai Ngo <Dai.Ngo@oracle.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Jakub Kicinski <kuba@kernel.org>,
Jeff Layton <jlayton@kernel.org>, Neil Brown <neilb@suse.de>,
Olga Kornievskaia <kolga@netapp.com>,
Paolo Abeni <pabeni@redhat.com>, Simo Sorce <simo@redhat.com>,
Tom Talpey <tom@talpey.com>,
Trond Myklebust <trond.myklebust@hammerspace.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sunrpc: Improve exception handling in krb5_etm_checksum()
Date: Mon, 1 Jan 2024 12:24:59 +0100 [thread overview]
Message-ID: <4307bce9-ccbd-4bc5-aa8e-b618a1664cbe@web.de> (raw)
In-Reply-To: <ZZIhEJK68Sapos2t@tissot.1015granger.net>
…
>> Thus use another label.
…
>> ---
>> net/sunrpc/auth_gss/gss_krb5_crypto.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
…
> As has undoubtedly been pointed out in other forums, calling kfree()
> with a NULL argument is perfectly valid.
The function call “kfree(NULL)” is not really useful for error/exception handling
while it is tolerated at various source code places.
> Since this small GFP_KERNEL
> allocation almost never fails, it's unlikely this change is going to
> make any difference except for readability.
I became curious if development interests can grow for the usage of
an additional label.
https://wiki.sei.cmu.edu/confluence/display/c/MEM12-C.+Consider+using+a+goto+chain+when+leaving+a+function+on+error+when+using+and+releasing+resources
> Now if we want to clean up the error flows in here to look more
> idiomatic, how about this:
…
> +++ b/net/sunrpc/auth_gss/gss_krb5_crypto.c
…
> @@ -970,8 +970,9 @@ u32 krb5_etm_checksum(struct crypto_sync_skcipher *cipher,
>
> out_free_ahash:
> ahash_request_free(req);
> -out_free_mem:
> +out_free_iv:
> kfree(iv);
> +out_free_cksumdata:
> kfree_sensitive(checksumdata);
…
I find it nice that you show another possible adjustment of corresponding identifiers.
Regards,
Markus
next prev parent reply other threads:[~2024-01-01 11:25 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-31 13:56 [PATCH] sunrpc: Improve exception handling in krb5_etm_checksum() Markus Elfring
2024-01-01 2:18 ` Chuck Lever
2024-01-01 11:24 ` Markus Elfring [this message]
2024-01-01 16:55 ` Chuck Lever
2024-01-02 9:26 ` Markus Elfring
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=4307bce9-ccbd-4bc5-aa8e-b618a1664cbe@web.de \
--to=markus.elfring@web.de \
--cc=Dai.Ngo@oracle.com \
--cc=anna@kernel.org \
--cc=ardb@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=herbert@gondor.apana.org.au \
--cc=jlayton@kernel.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=kolga@netapp.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=neilb@suse.de \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=simo@redhat.com \
--cc=tom@talpey.com \
--cc=trond.myklebust@hammerspace.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