On Mon, Sep 19, 2022 at 09:43:19AM +0300, Dan Carpenter wrote: > 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: d9110b0b01ff ("crypto: marvell - add support for OCTEON TX CPT engine") > Signed-off-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx> > --- > v2: In the first commit, I accidentally added some unnecessary checks. > Those were only drafts and I sent them uninitentionally. Sorry! > > .../crypto/marvell/octeontx/otx_cptpf_ucode.c | 18 ++++++++++++++++-- > 1 file changed, 16 insertions(+), 2 deletions(-) Patch applied. Thanks. -- Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt