提交 4f289826 编写于 作者: H Herbert Xu

crypto: caam - Avoid GCC memset bug warning

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.comReported-by: Nkernel test robot <lkp@intel.com>
Reported-by: NKees Cook <keescook@chromium.org>
Reported-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Tested-by: NUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Signed-off-by: NHerbert Xu <herbert@gondor.apana.org.au>
上级 7361d1bc
...@@ -163,7 +163,8 @@ static inline void append_data(u32 * const desc, const void *data, int len) ...@@ -163,7 +163,8 @@ static inline void append_data(u32 * const desc, const void *data, int len)
{ {
u32 *offset = desc_end(desc); 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); memcpy(offset, data, len);
(*desc) = cpu_to_caam32(caam32_to_cpu(*desc) + (*desc) = cpu_to_caam32(caam32_to_cpu(*desc) +
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册