[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y6wihNIoOT4pYB5+@gondor.apana.org.au>
Date: Wed, 28 Dec 2022 19:03:32 +0800
From: Herbert Xu <herbert@...dor.apana.org.au>
To: Uwe Kleine-König
<u.kleine-koenig@...gutronix.de>
Cc: Anders Roxell <anders.roxell@...aro.org>,
Kees Cook <keescook@...omium.org>,
Horia Geantă <horia.geanta@....com>,
Gaurav Jain <gaurav.jain@....com>,
Pankaj Gupta <pankaj.gupta@....com>,
linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
linux-crypto@...r.kernel.org, kernel@...gutronix.de,
"David S. Miller" <davem@...emloft.net>,
kernel test robot <lkp@...el.com>
Subject: [v2 PATCH] crypto: caam - Avoid GCC memset bug warning
On Wed, Dec 28, 2022 at 10:39:17AM +0100, Uwe Kleine-König wrote:
>
> Huh, broken encoding in the mail. I'd appreciate someone to doublecheck
> it's fine in the final commit.
>
> Tested-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Sorry. Let me try again:
---8<---
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@...el.com>
Reported-by: Kees Cook <keescook@...omium.org>
Reported-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@...gutronix.de>
Signed-off-by: Herbert Xu <herbert@...dor.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)
memcpy(offset, data, len);
(*desc) = cpu_to_caam32(caam32_to_cpu(*desc) +
--
Email: Herbert Xu <herbert@...dor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Powered by blists - more mailing lists