Skip to content

Commit ffe3ee8

Browse files
bwh-mindherbertx
authored andcommitted
crypto: omap - Avoid redundant copy when using truncated sg list
omap_crypto_cleanup() currently copies data from sg to orig if either copy flag is set. However OMAP_CRYPTO_SG_COPIED means that sg refers to the same pages as orig, truncated to len bytes. There is no need to copy in this case. Only copy data if the OMAP_CRYPTO_DATA_COPIED flag is set. Fixes: 74ed87e ("crypto: omap - add base support library for common ...") Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 9491923 commit ffe3ee8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/crypto/omap-crypto.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ void omap_crypto_cleanup(struct scatterlist *sg, struct scatterlist *orig,
210210
buf = sg_virt(sg);
211211
pages = get_order(len);
212212

213-
if (orig && (flags & OMAP_CRYPTO_COPY_MASK))
213+
if (orig && (flags & OMAP_CRYPTO_DATA_COPIED))
214214
omap_crypto_copy_data(sg, orig, offset, len);
215215

216216
if (flags & OMAP_CRYPTO_DATA_COPIED)

0 commit comments

Comments
 (0)