]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: xts - Replace memcpy() invocation with simple assignment
authorArd Biesheuvel <ardb@kernel.org>
Tue, 21 Jul 2020 06:05:54 +0000 (09:05 +0300)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 31 Jul 2020 08:09:00 +0000 (18:09 +1000)
commitcb0876f100af39bc5ee41d3f9b1ee9240cc420aa
tree2154c28f985065016cd67b4cd7aef640b947068b
parent6cc9dbda70a0815abde744fcb391d4947c88e538
crypto: xts - Replace memcpy() invocation with simple assignment

Colin reports that the memcpy() call in xts_cts_final() trigggers a
"Overlapping buffer in memory copy" warning in Coverity, which is a
false postive, given that tail is guaranteed to be smaller than or
equal to the distance between source and destination.

However, given that any additional bytes that we copy will be ignored
anyway, we can simply copy XTS_BLOCK_SIZE unconditionally, which means
we can use struct assignment of the array members instead, which is
likely to be more efficient as well.

Addresses-Coverity: ("Overlapping buffer in memory copy")
Fixes: 532a395f70cb ("crypto: xts - add support for ciphertext stealing")
Reported-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/xts.c