On 5. Aug 2024, at 19:59, Eric Biggers <ebiggers@xxxxxxxxxx> wrote: > On Mon, Aug 05, 2024 at 07:52:38PM +0200, Thorsten Blum wrote: >> struct poly_req { >> @@ -611,8 +611,8 @@ static int chachapoly_create(struct crypto_template *tmpl, struct rtattr **tb, >> poly->base.cra_priority) / 2; >> inst->alg.base.cra_blocksize = 1; >> inst->alg.base.cra_alignmask = chacha->base.cra_alignmask; >> - inst->alg.base.cra_ctxsize = sizeof(struct chachapoly_ctx) + >> - ctx->saltlen; >> + inst->alg.base.cra_ctxsize = struct_size_t(struct chachapoly_ctx, salt, >> + ctx->saltlen); > > What was wrong with the more straightforward code it had before? There's nothing wrong with it, but I find using the helper macro struct_size_t() more straightforward. It's just a refactoring; happy to take it out if there's a preference for the open coded version. Thanks, Thorsten