From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Herbert Xu <herbert@gondor.apana.org.au>
Cc: "Anders Roxell" <anders.roxell@linaro.org>,
"Kees Cook" <keescook@chromium.org>,
"Horia Geantă" <horia.geanta@nxp.com>,
"Gaurav Jain" <gaurav.jain@nxp.com>,
"Pankaj Gupta" <pankaj.gupta@nxp.com>,
linux-kernel@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-crypto@vger.kernel.org, kernel@pengutronix.de,
"David S. Miller" <davem@davemloft.net>,
"kernel test robot" <lkp@intel.com>
Subject: Re: [PATCH] crypto: caam - Avoid GCC memset bug warning
Date: Wed, 28 Dec 2022 12:30:35 +0100 [thread overview]
Message-ID: <20221228113035.ups6echnsmo4flnz@pengutronix.de> (raw)
In-Reply-To: <Y6wCbyttJ+WVzmZX@gondor.apana.org.au>
[-- Attachment #1: Type: text/plain, Size: 2235 bytes --]
On Wed, Dec 28, 2022 at 04:46:39PM +0800, Herbert Xu wrote:
> Certain versions of gcc don't like the memcpy with a NULL dst
> (which only happens with a zero length). This only happens
> when debugging is enabled so add an if clause to work around
> these warnings.
>
> A similar warning used to be generated by sparse but that was
> fixed years ago.
>
> Link: https://lore.kernel.org/lkml/202210290446.qBayTfzl-lkp@intel.com
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Kees Cook <keescook@chromium.org>
> Reported-by: Uwe Kleine-K�nig <u.kleine-koenig@pengutronix.de>
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
>
> diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h
> index 62ce6421bb3f..824c94d44f94 100644
> --- a/drivers/crypto/caam/desc_constr.h
> +++ b/drivers/crypto/caam/desc_constr.h
> @@ -163,7 +163,8 @@ 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 */
> + /* Avoid gcc warning: memcpy with data == NULL */
> + if (!IS_ENABLED(CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG) || data)
I just tried: For me a plain
if (data)
is also enough to make both gcc and sparse happy.
(On a related note, sparse reports:
CHECK drivers/crypto/caam/jr.c
drivers/crypto/caam/jr.c: note: in included file (through arch/arm64/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
include/asm-generic/io.h:290:22: warning: incorrect type in argument 1 (different base types)
include/asm-generic/io.h:290:22: expected unsigned long long [usertype] val
include/asm-generic/io.h:290:22: got restricted __le64 [usertype]
include/asm-generic/io.h:290:22: warning: incorrect type in argument 1 (different base types)
include/asm-generic/io.h:290:22: expected unsigned long long [usertype] val
include/asm-generic/io.h:290:22: got restricted __le64 [usertype]
Didn't look into that though.)
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-König |
Industrial Linux Solutions | https://www.pengutronix.de/ |
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2022-12-28 11:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20221222162513.4021928-1-u.kleine-koenig@pengutronix.de>
[not found] ` <Y6VK4IJkHiawAbJz@gondor.apana.org.au>
[not found] ` <20221223174719.4n6pmwio4zycj2qm@pengutronix.de>
2022-12-28 8:46 ` Herbert Xu
2022-12-28 9:39 ` Uwe Kleine-König
2022-12-28 11:03 ` [v2 PATCH] " Herbert Xu
2022-12-28 11:30 ` Uwe Kleine-König [this message]
2022-12-29 1:48 ` [PATCH] " Herbert Xu
2022-12-31 16:44 ` David Laight
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=20221228113035.ups6echnsmo4flnz@pengutronix.de \
--to=u.kleine-koenig@pengutronix.de \
--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=keescook@chromium.org \
--cc=kernel@pengutronix.de \
--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
all inboxes | Powered by JetHome®