From: Sean Anderson <sean.anderson@seco.com>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: linux-crypto@vger.kernel.org,
"David S . Miller" <davem@davemloft.net>,
"Aymen Sghaier" <aymen.sghaier@nxp.com>,
linux-arm-kernel@lists.infradead.org,
"Marek Vasut" <marex@denx.de>,
"Horia Geantă" <horia.geanta@nxp.com>
Subject: Re: [PATCH 2/2] crypto: mxs_dcp: Use sg_mapping_iter to copy data
Date: Thu, 24 Jun 2021 10:58:48 -0400 [thread overview]
Message-ID: <dfe6dc8d-8e26-643e-1e29-6bf05611e9db@seco.com> (raw)
In-Reply-To: <20210624065644.GA7826@gondor.apana.org.au>
On 6/24/21 2:56 AM, Herbert Xu wrote:
> On Fri, Jun 18, 2021 at 05:14:11PM -0400, Sean Anderson wrote:
>> This uses the sg_miter_*() functions to copy data, instead of doing it
>> ourselves. Using sg_copy_buffer() would be better, but this way we don't
>> have to keep traversing the beginning of the scatterlist every time we
>> do another copy.
>>
>> In addition to reducing code size, this fixes the following oops
>> resulting from failing to kmap the page:
>
> Thanks for the patch. Just a minor nit:
>
>> @@ -365,25 +364,13 @@ static int mxs_dcp_aes_block_crypt(struct crypto_async_request *arq)
>>
>> out_tmp = out_buf;
>> last_out_len = actx->fill;
>> - while (dst && actx->fill) {
>> - if (!split) {
>> - dst_buf = sg_virt(dst);
>> - dst_off = 0;
>> - }
>> - rem = min(sg_dma_len(dst) - dst_off,
>> - actx->fill);
>> -
>> - memcpy(dst_buf + dst_off, out_tmp, rem);
>> +
>> + while (sg_miter_next(&dst_iter) && actx->fill) {
>> + rem = min(dst_iter.length, actx->fill);
>
> This comparison generates a sparse warning due to conflicting types,
> please fix this and resubmit.
What exactly is the warning here? dst_iter.length is a size_t, and
actx->fill is a u32. So fill will be converted to a size_t before the
comparison, which is lossless.
--Sean
next prev parent reply other threads:[~2021-06-24 14:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-18 21:14 [PATCH 1/2] crypto: mxs-dcp: Check for DMA mapping errors Sean Anderson
2021-06-18 21:14 ` [PATCH 2/2] crypto: mxs_dcp: Use sg_mapping_iter to copy data Sean Anderson
2021-06-24 6:56 ` Herbert Xu
2021-06-24 14:58 ` Sean Anderson [this message]
2021-06-25 0:16 ` Herbert Xu
2021-06-25 14:49 ` Sean Anderson
2021-06-26 3:00 ` Herbert Xu
2021-06-28 3:25 ` Herbert Xu
2021-06-28 17:44 ` Sean Anderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dfe6dc8d-8e26-643e-1e29-6bf05611e9db@seco.com \
--to=sean.anderson@seco.com \
--cc=aymen.sghaier@nxp.com \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-crypto@vger.kernel.org \
--cc=marex@denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).