mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-13 14:24:11 +08:00
crypto: rsa - add a check for allocation failure
[ Upstream commitd872ca165c
] Static checkers insist that the mpi_alloc() allocation can fail so add a check to prevent a NULL dereference. Small allocations like this can't actually fail in current kernels, but adding a check is very simple and makes the static checkers happy. Fixes:6637e11e4a
("crypto: rsa - allow only odd e and restrict value in FIPS mode") Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
089ff0eeb7
commit
2831f4d3bf
@ -220,6 +220,8 @@ static int rsa_check_exponent_fips(MPI e)
|
||||
}
|
||||
|
||||
e_max = mpi_alloc(0);
|
||||
if (!e_max)
|
||||
return -ENOMEM;
|
||||
mpi_set_bit(e_max, 256);
|
||||
|
||||
if (mpi_cmp(e, e_max) >= 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user