Re: [PATCH 2/2] crypto: mxs_dcp: Use sg_mapping_iter to copy data

From
Herbert Xu <herbert@gondor.apana.org.au>
Date
2021-06-24 06:56:52
Also in
linux-crypto
Reply to
Sean Anderson, 2021-06-18
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:
quoted hunk ↗ jump to hunk
@@ -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.

Cheers,
-- 
Email: Herbert Xu [off-list ref]
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Thread (9 messages) 9 messages, 2 authors, last reply 2021-06-28
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help