lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 29 Dec 2022 09:48:36 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     Uwe Kleine-König 
        <u.kleine-koenig@...gutronix.de>
Cc:     Anders Roxell <anders.roxell@...aro.org>,
        Kees Cook <keescook@...omium.org>,
        Horia Geantă <horia.geanta@....com>,
        Gaurav Jain <gaurav.jain@....com>,
        Pankaj Gupta <pankaj.gupta@....com>,
        linux-kernel@...r.kernel.org, linux-hardening@...r.kernel.org,
        linux-crypto@...r.kernel.org, kernel@...gutronix.de,
        "David S. Miller" <davem@...emloft.net>,
        kernel test robot <lkp@...el.com>
Subject: Re: [PATCH] crypto: caam - Avoid GCC memset bug warning

On Wed, Dec 28, 2022 at 12:30:35PM +0100, Uwe Kleine-König wrote:
>
> > -	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)
> 
> I just tried: For me a plain
> 
> 	if (data)
> 
> is also enough to make both gcc and sparse happy.

Of course it is.  The point of the extra condition is to remove
the unnecessary check on data unless we are in debugging mode
(as it is only needed in debugging mode to work around the buggy
compiler).

> (On a related note, sparse reports:
> 
>   CHECK   drivers/crypto/caam/jr.c
> drivers/crypto/caam/jr.c: note: in included file (through arch/arm64/include/asm/io.h, include/linux/io.h, include/linux/irq.h, ...):
> include/asm-generic/io.h:290:22: warning: incorrect type in argument 1 (different base types)
> include/asm-generic/io.h:290:22:    expected unsigned long long [usertype] val
> include/asm-generic/io.h:290:22:    got restricted __le64 [usertype]
> include/asm-generic/io.h:290:22: warning: incorrect type in argument 1 (different base types)
> include/asm-generic/io.h:290:22:    expected unsigned long long [usertype] val
> include/asm-generic/io.h:290:22:    got restricted __le64 [usertype]

That's a bug in include/asm-generic/io.h.  It feeds an __le64 to
__raw_writeq which wants a u64.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ