Ignat Korchagin <[email protected]> wrote:
> A lot of pointers and arithmetic here. Wouldn't it be easier to do
> something like in [1]?
Fair point.
> > +DEFINE_FREE(crypto_free_shash, struct crypto_shash*,
> > + if (!IS_ERR_OR_NULL(_T)) { crypto_free_shash(_T); });
>
> Is this useful enough to go into some commonly used header for shash?
Maybe - I guess there's no actual cost to doing so as it generates an inline
function.
> > + struct crypto_shash *hash_tfm __free(crypto_free_shash) = NULL;
> > + struct shash_desc *Hash __free(kfree) = NULL;
>
> So even though x509/pkcs7 code now has a counterexample (partially due
> to my fault) seems the consensus [2] is to declare and initialise the
> variable with the __free attribute at the same time meaning it is OK
> to declare the variables later and not follow the "declaration at the
> top" rule.
Ok, I'll move the decls.
David