Re: [PATCH] crypto: caam - Prevent fortify error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 22, 2022 at 05:25:13PM +0100, Uwe Kleine-König wrote:
> When compiling arm64 allmodconfig  with gcc 10.2.1 I get
> 
> 	drivers/crypto/caam/desc_constr.h: In function ‘append_data.constprop’:
> 	include/linux/fortify-string.h:57:29: error: argument 2 null where non-null expected [-Werror=nonnull]
> 
> Fix this by skipping the memcpy if data is NULL and add a BUG_ON instead
> that triggers on a problematic call that is now prevented to trigger.
> After data == NULL && len != 0 is known to be false, logically
> 
> 	if (len)
> 		memcpy(...)
> 
> could be enough to know that memcpy is not called with dest=NULL, but
> gcc doesn't seem smart enough for that conclusion. gcc 12 doesn't have a
> problem with the original code.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx>
> ---
>  drivers/crypto/caam/desc_constr.h | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)

Does this patch fix your problem?

https://lore.kernel.org/all/Y4mHjKXnF%2F4Pfw5I@xxxxxxxxxxxxxxxxxxx/

If not please send me your kconfig file.

Thanks,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux