linux/drivers/crypto/marvell
Dan Carpenter 12acfa1059 crypto: marvell/octeontx - prevent integer overflows
[ Upstream commit caca37cf6c ]

The "code_length" value comes from the firmware file.  If your firmware
is untrusted realistically there is probably very little you can do to
protect yourself.  Still we try to limit the damage as much as possible.
Also Smatch marks any data read from the filesystem as untrusted and
prints warnings if it not capped correctly.

The "code_length * 2" can overflow.  The round_up(ucode_size, 16) +
sizeof() expression can overflow too.  Prevent these overflows.

Fixes: d9110b0b01 ("crypto: marvell - add support for OCTEON TX CPT engine")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2022-10-26 12:35:27 +02:00
..
cesa crypto: marvell/cesa - ECB does not IV 2022-06-09 10:23:06 +02:00
octeontx crypto: marvell/octeontx - prevent integer overflows 2022-10-26 12:35:27 +02:00
octeontx2 crypto: octeontx2 - remove CONFIG_DM_CRYPT check 2022-04-08 14:23:05 +02:00
Kconfig crypto: marvell - CRYPTO_DEV_OCTEONTX2_CPT should depend on ARCH_THUNDER2 2021-02-10 17:54:31 +11:00
Makefile crypto: marvell - add Marvell OcteonTX2 CPT PF driver 2021-01-22 14:58:02 +11:00