[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <355bc65b-fbc4-deee-058a-999e5b740819@c-s.fr>
Date: Fri, 2 Mar 2018 18:42:00 +0100
From: Christophe LEROY <christophe.leroy@....fr>
To: Horia Geantă <horia.geanta@....com>,
Herbert Xu <herbert@...dor.apana.org.au>,
"David S. Miller" <davem@...emloft.net>
Cc: "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>
Subject: Re: [PATCH 17/18] crypto: talitos - chain in buffered data for ahash
on SEC1
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
Powered by blists - more mailing lists