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

Herbert Xu herbert at gondor.apana.org.au
Wed Jun 23 23:56:44 PDT 2021


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.

Cheers,
-- 
Email: Herbert Xu <herbert at gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



More information about the linux-arm-kernel mailing list