Skip to content

Commit 4f28982

Browse files
committed
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/[email protected] Reported-by: kernel test robot <[email protected]> Reported-by: Kees Cook <[email protected]> Reported-by: Uwe Kleine-König <[email protected]> Tested-by: Uwe Kleine-König <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 7361d1b commit 4f28982

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/crypto/caam/desc_constr.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ static inline void append_data(u32 * const desc, const void *data, int len)
163163
{
164164
u32 *offset = desc_end(desc);
165165

166-
if (len) /* avoid sparse warning: memcpy with byte count of 0 */
166+
/* Avoid gcc warning: memcpy with data == NULL */
167+
if (!IS_ENABLED(CONFIG_CRYPTO_DEV_FSL_CAAM_DEBUG) || data)
167168
memcpy(offset, data, len);
168169

169170
(*desc) = cpu_to_caam32(caam32_to_cpu(*desc) +

0 commit comments

Comments
 (0)