lkml.org 
[lkml]   [2022]   [Dec]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] crypto/caam: Avoid GCC constprop bug warning
On Thu, Dec 01, 2022 at 05:04:14PM -0800, Kees Cook wrote:
>
> diff --git a/drivers/crypto/caam/desc_constr.h b/drivers/crypto/caam/desc_constr.h
> index 62ce6421bb3f..d9da4173af9d 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 NULL dest (but byte count of 0). */
> + if (data && len)
> memcpy(offset, data, len);

This makes no sense. The if clause was added to silence sparse.
That then in turn caused gcc to barf. However, sparse has since
been fixed so that it doesn't warn without the if clause.

The solution is not to keep adding crap to the if clause, but to
get rid of it once and for all.

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

\
 
 \ /
  Last update: 2022-12-02 03:51    [W:0.070 / U:0.620 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site