[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6795494.nv2bFMflat@tauon.chronox.de>
Date: Sat, 21 Oct 2017 21:07:28 +0200
From: Stephan Mueller <smueller@...onox.de>
To: SF Markus Elfring <elfring@...rs.sourceforge.net>
Cc: linux-crypto@...r.kernel.org,
"David S. Miller" <davem@...emloft.net>,
Herbert Xu <herbert@...dor.apana.org.au>,
LKML <linux-kernel@...r.kernel.org>,
kernel-janitors@...r.kernel.org
Subject: Re: [PATCH 1/2] crypto-testmgr: Use common error handling code in drbg_cavs_test()
Am Samstag, 21. Oktober 2017, 19:53:54 CEST schrieb SF Markus Elfring:
Hi Markus,
> From: Markus Elfring <elfring@...rs.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
Powered by blists - more mailing lists