From: Kees Cook <keescook@chromium.org>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Horia Geantă" <horia.geanta@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
"Gaurav Jain" <gaurav.jain@nxp.com>,
"David S. Miller" <davem@davemloft.net>,
linux-crypto@vger.kernel.org, "kernel test robot" <lkp@intel.com>,
"Anders Roxell" <anders.roxell@linaro.org>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org
Subject: Re: [PATCH v2] crypto/caam: Avoid GCC constprop bug warning
Date: Fri, 2 Dec 2022 10:54:05 -0800 [thread overview]
Message-ID: <202212021049.16C438A@keescook> (raw)
In-Reply-To: <Y4mHjKXnF/4Pfw5I@gondor.apana.org.au>
On Fri, Dec 02, 2022 at 01:05:16PM +0800, Herbert Xu wrote:
> On Thu, Dec 01, 2022 at 07:30:22PM -0800, Kees Cook wrote:
> >
> > Getting rid of the if doesn't solve the warning. I can switch it to just
> > "if (data)", though. That keeps GCC happy.
>
> OK I misread the thread.
>
> Anyhow, it appears that this warning only occurs due to a debug
> printk in caam. So how about something like this?
What? I don't think that's true? I think
CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG only controls "PRINT_POS", which is
unrelated?
The call path is:
drivers/crypto/caam/key_gen.c: gen_split_key()
append_fifo_load_as_imm(..., NULL, ...) <- literal NULL
append_cmd_data(..., data, ...)
memcpy(..., data, ...)
and doesn't seem affected at all by CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG.
-Kees
>
> diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h
> index 62ce6421bb3f..b49c995e1cc6 100644
> --- a/drivers/crypto/caam/desc_constr.h
> +++ b/drivers/crypto/caam/desc_constr.h
> @@ -163,7 +163,7 @@ static inline void append_data(u32 * const desc, const void *data, int len)
> {
> u32 *offset = desc_end(desc);
>
> - if (len) /* avoid sparse warning: memcpy with byte count of 0 */
> + if (!IS_ENABLED(CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG) || data)
> memcpy(offset, data, len);
>
> (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) +
--
Kees Cook
next prev parent reply other threads:[~2022-12-02 18:54 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-02 1:04 [PATCH v2] crypto/caam: Avoid GCC constprop bug warning Kees Cook
2022-12-02 2:50 ` Herbert Xu
2022-12-02 3:30 ` Kees Cook
2022-12-02 5:05 ` Herbert Xu
2022-12-02 18:54 ` Kees Cook [this message]
2022-12-02 23:36 ` Herbert Xu
2022-12-02 3:18 ` Eric Biggers
2022-12-02 3:23 ` Kees Cook
2022-12-02 3:32 ` Eric Biggers
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=202212021049.16C438A@keescook \
--to=keescook@chromium.org \
--cc=anders.roxell@linaro.org \
--cc=davem@davemloft.net \
--cc=gaurav.jain@nxp.com \
--cc=herbert@gondor.apana.org.au \
--cc=horia.geanta@nxp.com \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=pankaj.gupta@nxp.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox