All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@arndb.de>
To: kbuild-all@lists.01.org
Subject: Re: [arm-integrator:ixp4xx-test 22/23] drivers/crypto/ixp4xx_crypto.c:1060 aead_perform() error: uninitialized symbol 'icv_rev_aes'.
Date: Fri, 11 Oct 2019 23:48:16 +0200	[thread overview]
Message-ID: <CAK8P3a2ispwHfyBmRQa3GTAw8EWOEfNKHOinkQO=v-DNvWi9pw@mail.gmail.com> (raw)
In-Reply-To: <20191011104117.GT13286@kadam>

[-- Attachment #1: Type: text/plain, Size: 2019 bytes --]

On Fri, Oct 11, 2019 at 12:41 PM Dan Carpenter <dan.carpenter@oracle.com> wrote:
>
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-integrator.git ixp4xx-test
> head:   1b826e686b390fd1eeb347def38185fefcbd5140
> commit: 811c4aaa704314770fe5a70944100732fdc1f3b8 [22/23] crypto: ixp4xx: avoid BUILD_BUG_ON()
>
> If you fix the issue, kindly add following tag
> Reported-by: kbuild test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>
> New smatch warnings:
> drivers/crypto/ixp4xx_crypto.c:1060 aead_perform() error: uninitialized symbol 'icv_rev_aes'.

Right, this was uncovered by allowing the driver to be compile-tested on
x86. smatch is of course right to point out the uninitialized variable,
but it seems harmless as it is only uninitialized in case of an error,
and the uninitialized variable here gets copied into another data structure
that then gets put back, so it seems completely harmless

There is a trivial fix:

diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index 1c6a04ecbf8f..a4eb1e98c87b 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -1057,9 +1057,9 @@ static int aead_perform(struct aead_request
*req, int encrypt,
                 * we need to copy them into a safe buffer */
                req_ctx->hmac_virt = dma_pool_alloc(buffer_pool, flags,
                                                    &icv_rev_aes);
-               crypt->icv_rev_aes = (u32)icv_rev_aes;
                if (unlikely(!req_ctx->hmac_virt))
                        goto free_buf_dst;
+               crypt->icv_rev_aes = (u32)icv_rev_aes;
                if (!encrypt) {
                        scatterwalk_map_and_copy(req_ctx->hmac_virt,
                                req->src, cryptlen, authsize, 0);

Dan, I think I would just leave it unchanged for a case like this, but I
can send a patch if you think it's worth addressing the warning.

     Arnd

  reply	other threads:[~2019-10-11 21:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-11 10:41 [arm-integrator:ixp4xx-test 22/23] drivers/crypto/ixp4xx_crypto.c:1060 aead_perform() error: uninitialized symbol 'icv_rev_aes' Dan Carpenter
2019-10-11 10:41 ` Dan Carpenter
2019-10-11 21:48 ` Arnd Bergmann [this message]
2019-10-11 21:53   ` Arnd Bergmann
2019-10-18 14:49     ` Linus Walleij
2019-10-12  8:08   ` Dan Carpenter
2019-10-12  8:08     ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAK8P3a2ispwHfyBmRQa3GTAw8EWOEfNKHOinkQO=v-DNvWi9pw@mail.gmail.com' \
    --to=arnd@arndb.de \
    --cc=kbuild-all@lists.01.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.