Re: [PATCH 3/3] s390/crypto: Enable CONTEXT_ANALYSIS
| Newsgroups | org.kernel.vger.linux-s390 |
|---|---|
| Message-ID | <[email protected]> |
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider: - [High] Missing error check for `skcipher_walk_virt()` in `ctr_aes_crypt()` causes errors to be silently swallowed. -- --- Patch [3]: [PATCH 3/3] s390/crypto: Enable CONTEXT_ANALYSIS --- commit 2232f8277d7ab7cfce4ac97a8923bcf8c4ed60e3 Author: Heiko Carstens <[email protected]> s390/crypto: Enable CONTEXT_ANALYSIS Enable CONTEXT_ANALYSIS since s390's crypto code compiles now without warnings. > diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile > index 48aeb0c0ffbd6..1d64208139357 100644 > --- a/arch/s390/crypto/Makefile > +++ b/arch/s390/crypto/Makefile > @@ -3,6 +3,8 @@ > # Cryptographic API > # > > +CONTEXT_ANALYSIS := y > + [Severity: High] Does this code silently swallow errors from skcipher_walk_virt()? In arch/s390/crypto/aes_s390.c:ctr_aes_crypt(): ret = skcipher_walk_virt(&walk, req, false); if (mutex_trylock(&ctrblk_lock)) { ret = __ctr_aes_crypt(sctx, &walk, true); mutex_unlock(&ctrblk_lock); } else { ret = __ctr_aes_crypt(sctx, &walk, false); } If memory allocation or scatterlist setup fails during skcipher_walk_virt(), it returns an error code (such as -ENOMEM or -EINVAL). Because ret is immediately overwritten by __ctr_aes_crypt() without being checked, the caller may incorrectly receive 0 (success). This causes a silent failure where unencrypted or undecrypted data may be consumed by the caller. Could we add an error check before calling __ctr_aes_crypt()? > obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o -- Sashiko AI review · https://sashiko.dev/#/patchset/[email protected]?part=3