Re: [PATCH 2/10] crypto: aead - Count error stats differently

Herbert Xu
2023-02-16T06:00:28Z

On Wed, Feb 15, 2023 at 09:45:13PM -0800, Eric Biggers wrote:
>
> This could be just:
>
> static int __maybe_unused
> crypto_aead_report_stat(struct sk_buff *skb, struct crypto_alg *alg)

Good point. I'll convert them over.

> But actually it might be better to keep #ifdef-ing this whole function out when
> !CONFIG_CRYPTO_STATS, since in that case it contains an unconditional null
> pointer dereference. Yes, it's not executed, but it might be confusing.

But then I'd need to compile this twice for testing so I'd rather
keep it this way.

> > + if (IS_ENABLED(CONFIG_CRYPTO_STATS))
> > + memset(istat, 0, sizeof(*istat));
> > +
>
> Above is another place that can just do 'if (istat)'.

As I mentioned before, this would create an unnecessary branch
when STATS are enabled (which would presumably be the common case).

Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt