linux/drivers/crypto/qce
Nathan Chancellor 7b6092ee7a crypto: qce - revert "use __free() for a buffer that's always freed"
Commit ce8fd0500b ("crypto: qce - use __free() for a buffer that's
always freed") introduced a buggy use of __free(), which clang
rightfully points out:

  drivers/crypto/qce/sha.c:365:3: error: cannot jump from this goto statement to its label
    365 |                 goto err_free_ahash;
        |                 ^
  drivers/crypto/qce/sha.c:373:6: note: jump bypasses initialization of variable with __attribute__((cleanup))
    373 |         u8 *buf __free(kfree) = kzalloc(keylen + QCE_MAX_ALIGN_SIZE,
        |             ^

Jumping over a variable declared with the cleanup attribute does not
prevent the cleanup function from running; instead, the cleanup function
is called with an uninitialized value.

Moving the declaration back to the top function with __free() and a NULL
initialization would resolve the bug but that is really not much
different from the original code. Since the function is so simple and
there is no functional reason to use __free() here, just revert the
original change to resolve the issue.

Fixes: ce8fd0500b ("crypto: qce - use __free() for a buffer that's always freed")
Reported-by: Linux Kernel Functional Testing <lkft@linaro.org>
Closes: https://lore.kernel.org/CA+G9fYtpAwXa5mUQ5O7vDLK2xN4t-kJoxgUe1ZFRT=AGqmLSRA@mail.gmail.com/
Signed-off-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
2024-12-21 22:46:24 +08:00
..
aead.c crypto: qce - fix priority to be less than ARMv8 CE 2024-12-14 17:21:43 +08:00
aead.h crypto: qce - Schedule fallback aead algorithm 2021-05-14 19:07:56 +08:00
cipher.h crypto: qce - Remover src_tbl from qce_cipher_reqctx 2021-03-07 15:13:17 +11:00
common.c crypto: qce - Set DMA alignment explicitly 2022-12-09 18:45:00 +08:00
common.h crypto: qce - Add support for AEAD algorithms 2021-05-14 19:07:55 +08:00
core.c crypto: qce - switch to using a mutex 2024-12-14 17:21:43 +08:00
core.h crypto: qce - switch to using a mutex 2024-12-14 17:21:43 +08:00
dma.c crypto: qce - convert qce_dma_request() to use devres 2024-12-14 17:21:43 +08:00
dma.h crypto: qce - convert qce_dma_request() to use devres 2024-12-14 17:21:43 +08:00
Makefile crypto: qce - Add support for AEAD algorithms 2021-05-14 19:07:55 +08:00
regs-v5.h
sha.c crypto: qce - revert "use __free() for a buffer that's always freed" 2024-12-21 22:46:24 +08:00
sha.h crypto: sha - split sha.h into sha1.h and sha2.h 2020-11-20 14:45:33 +11:00
skcipher.c crypto: qce - fix priority to be less than ARMv8 CE 2024-12-14 17:21:43 +08:00