crypto: caam - Clear some memory in instantiate_rng
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>
Tue, 21 Mar 2023 06:59:30 +0000 (07:59 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 11 May 2023 14:03:20 +0000 (23:03 +0900)
commitbe421554994b4b5e70d94153d41589369f192e72
treecf761a2880dafe26318b44cc27ee44d8228c1845
parent74f74c8b8419a289b85aa9c85e5f4d8c2cc9f5fb
crypto: caam - Clear some memory in instantiate_rng

[ Upstream commit 9c19fb86a8cb2ee82a832c95e139f29ea05c4d08 ]

According to the comment at the end of the 'for' loop just a few lines
below, it looks needed to clear 'desc'.

So it should also be cleared for the first iteration.

Move the memset() to the beginning of the loop to be safe.

Fixes: 281922a1d4f5 ("crypto: caam - add support for SEC v5.x RNG4")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Reviewed-by: Gaurav Jain <gaurav.jain@nxp.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/crypto/caam/ctrl.c