public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephan Mueller <smueller@chronox.de>
To: SF Markus Elfring <elfring@users.sourceforge.net>
Cc: linux-crypto@vger.kernel.org,
	"David S. Miller" <davem@davemloft.net>,
	Herbert Xu <herbert@gondor.apana.org.au>,
	LKML <linux-kernel@vger.kernel.org>,
	kernel-janitors@vger.kernel.org
Subject: Re: [PATCH 1/2] crypto-testmgr: Use common error handling code in drbg_cavs_test()
Date: Sat, 21 Oct 2017 19:07:28 +0000	[thread overview]
Message-ID: <6795494.nv2bFMflat@tauon.chronox.de> (raw)
In-Reply-To: <7aa0ec0b-c00e-44c0-1c07-6bd87e2b6c47@users.sourceforge.net>

Am Samstag, 21. Oktober 2017, 19:53:54 CEST schrieb SF Markus Elfring:

Hi Markus,

> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Sat, 21 Oct 2017 19:29:11 +0200
> 
> Adjust jump targets so that a bit of exception handling can be better
> reused at the end of this function.
> 
> This issue was detected by using the Coccinelle software.

Thank you for this patch.

> -outbuf:
> +	ret = memcmp(test->expected, buf, test->expectedlen);
> +free_rng:
>  	crypto_free_rng(drng);
> +free_buffer:
>  	kzfree(buf);
>  	return ret;
> +
> +report_failure:
> +	pr_err("alg: drbg: could not obtain random data for driver %s\n",
> +	       driver);
> +	goto free_rng;

Though, jumping back and forth like this with goto directives is something 
that looks a bit strange. At least to my taste, may I suggest to have gotos 
pointing only downwards and not up again? (Note, the same applies to the 
ansi_cprng patch set).

What about something like following:

...
    memcmp
    goto free_rng;

report_failure:
    <failure report>

free_rng:
    <the deallocation code>

Ciao
Stephan

  reply	other threads:[~2017-10-21 19:07 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-21 17:52 [PATCH 0/2] crypto-testmgr: Fine-tuning for drbg_cavs_test() SF Markus Elfring
2017-10-21 17:53 ` [PATCH 1/2] crypto-testmgr: Use common error handling code in drbg_cavs_test() SF Markus Elfring
2017-10-21 19:07   ` Stephan Mueller [this message]
2017-10-21 20:00     ` SF Markus Elfring
2017-10-21 17:55 ` [PATCH 2/2] crypto-testmgr: Delete an unnecessary variable initialisation " SF 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=6795494.nv2bFMflat@tauon.chronox.de \
    --to=smueller@chronox.de \
    --cc=davem@davemloft.net \
    --cc=elfring@users.sourceforge.net \
    --cc=herbert@gondor.apana.org.au \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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