Messages in this thread Patch in this message | | | Date | Fri, 2 Dec 2022 13:05:16 +0800 | From | Herbert Xu <> | Subject | Re: [PATCH v2] crypto/caam: Avoid GCC constprop bug warning |
| |
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?
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) + Thanks, -- Email: Herbert Xu <herbert@gondor.apana.org.au> Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
| |