lkml.org 
[lkml]   [2018]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH 17/18] crypto: talitos - chain in buffered data for ahash on SEC1
From
Date


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

\
 
 \ /
  Last update: 2018-03-02 18:42    [W:0.042 / U:7.568 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site