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, 13 Feb 2020 23:46:28 -0700
From:   Nathan Chancellor <natechancellor@...il.com>
To:     Joe Perches <joe@...ches.com>
Cc:     Heiko Carstens <heiko.carstens@...ibm.com>,
        Vasily Gorbik <gor@...ux.ibm.com>,
        Christian Borntraeger <borntraeger@...ibm.com>,
        linux-s390@...r.kernel.org, linux-kernel@...r.kernel.org,
        clang-built-linux@...glegroups.com
Subject: Re: [PATCH] s390/kaslr: Fix casts in get_random

On Sat, Feb 08, 2020 at 12:17:20PM -0800, Joe Perches wrote:
> On Sat, 2020-02-08 at 07:10 -0700, Nathan Chancellor wrote:
> > Clang warns:
> > 
> > ../arch/s390/boot/kaslr.c:78:25: warning: passing 'char *' to parameter
> > of type 'const u8 *' (aka 'const unsigned char *') converts between
> > pointers to integer
> > types with different sign [-Wpointer-sign]
> >                                   (char *) entropy, (char *) entropy,
> >                                                     ^~~~~~~~~~~~~~~~
> > ../arch/s390/include/asm/cpacf.h:280:28: note: passing argument to
> > parameter 'src' here
> >                             u8 *dest, const u8 *src, long src_len)
> >                                                 ^
> > 2 warnings generated.
> > 
> > Fix the cast to match what else is done in this function.
> > 
> > Fixes: b2d24b97b2a9 ("s390/kernel: add support for kernel address space layout randomization (KASLR)")
> > Link: https://github.com/ClangBuiltLinux/linux/issues/862
> > Signed-off-by: Nathan Chancellor <natechancellor@...il.com>
> > ---
> >  arch/s390/boot/kaslr.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/arch/s390/boot/kaslr.c b/arch/s390/boot/kaslr.c
> > index 5d12352545c5..5591243d673e 100644
> > --- a/arch/s390/boot/kaslr.c
> > +++ b/arch/s390/boot/kaslr.c
> > @@ -75,7 +75,7 @@ static unsigned long get_random(unsigned long limit)
> >  		*(unsigned long *) prng.parm_block ^= seed;
> >  		for (i = 0; i < 16; i++) {
> >  			cpacf_kmc(CPACF_KMC_PRNG, prng.parm_block,
> > -				  (char *) entropy, (char *) entropy,
> > +				  (u8 *) entropy, (u8 *) entropy,
> 
> Why not change the function to take void *?
> 
> static inline int cpacf_kmc(unsigned long func, void *param,
> 			    u8 *dest, const u8 *src, long src_len)
> 
> vs:
> 
> static inline int cpacf_kmc(unsigned long func, void *param,
> 			    void *dest, const void *src, long src_len)
> 
> and remove the casts?

I can certainly do that if the maintainers prefer it.

Cheers,
Nathan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ