[PATCH 17/18] crypto: talitos - chain in buffered data for ahash on SEC1
Christophe LEROY
christophe.leroy at c-s.fr
Sat Mar 3 04:42:00 AEDT 2018
Le 02/03/2018 à 18:27, Horia Geantă a écrit :
> On 10/6/2017 4:05 PM, Christophe Leroy wrote:
> [...]
>> @@ -1778,6 +1814,36 @@ static int common_nonsnoop_hash(struct talitos_edesc *edesc,
>> if (is_sec1 && from_talitos_ptr_len(&desc->ptr[3], true) == 0)
>> talitos_handle_buggy_hash(ctx, edesc, &desc->ptr[3]);
>>
>> + if (is_sec1 && req_ctx->nbuf && length) {
>> + struct talitos_desc *desc2 = desc + 1;
>> + dma_addr_t next_desc;
> [...]
>> + next_desc = dma_map_single(dev, &desc2->hdr1, TALITOS_DESC_SIZE,
>> + DMA_BIDIRECTIONAL);
>> + desc->next_desc = cpu_to_be32(next_desc);
> Where is desc->next_desc initialized for the !is_sec1 case?
> Memory allocation is done using kmalloc(), and since desc->next_desc is checked
> in some cases also for SEC 2.x+, it should be initialized to 0.
See
https://elixir.bootlin.com/linux/v4.16-rc3/source/drivers/crypto/talitos.c#L1411
edesc = kmalloc(alloc_len, GFP_DMA | flags);
if (!edesc) {
dev_err(dev, "could not allocate edescriptor\n");
err = ERR_PTR(-ENOMEM);
goto error_sg;
}
memset(&edesc->desc, 0, sizeof(edesc->desc));
Christophe
More information about the Linuxppc-dev
mailing list