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] [day] [month] [year] [list]
Date:	Fri, 12 Jun 2009 15:11:45 +0200
From:	Andreas Herrmann <andreas.herrmann3@....com>
To:	Thomas Gleixner <tglx@...utronix.de>
CC:	Stephen Rothwell <sfr@...b.auug.org.au>,
	Ingo Molnar <mingo@...e.hu>, "H. Peter Anvin" <hpa@...or.com>,
	Peter Zijlstra <peterz@...radead.org>,
	linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
	Yinghai Lu <yinghai@...nel.org>
Subject: Re: [PATCH] x86: memtest: fix compile warning

On Thu, Jun 11, 2009 at 05:26:58PM +0200, Andreas Herrmann wrote:
> On Thu, Jun 11, 2009 at 04:21:41PM +0200, Thomas Gleixner wrote:
> > On Thu, 11 Jun 2009, Andreas Herrmann wrote:
> > 
> > > Commit c9690998ef48ffefeccb91c70a7739eebdea57f9
> > > (x86: memtest: remove 64-bit division) introduced following compile warning:
> > > 
> > >  arch/x86/mm/memtest.c: In function 'memtest':
> > >  arch/x86/mm/memtest.c:56: warning: comparison of distinct pointer types lacks a cast
> > >  arch/x86/mm/memtest.c:58: warning: comparison of distinct pointer types lacks a cast
> > > 
> > > Signed-off-by: Andreas Herrmann <andreas.herrmann3@....com>
> > > ---
> > >  arch/x86/mm/memtest.c |    4 ++--
> > >  1 files changed, 2 insertions(+), 2 deletions(-)
> > > 
> > > Sorry.
> > > Please apply.
> > 
> > I applied it already, but zapped it right away, as it is bad style to
> > do the type casting in the loops. The proper fix is below.
> 
> Doesn't your fix re-introduces the 64-bit division problem with old
> gcc?  I removed that division with the mentioned commit just forgot to
> type-cast the pointer.

It doesn't.

> > diff --git a/arch/x86/mm/memtest.c b/arch/x86/mm/memtest.c
> > index d1c5cef..18d244f 100644
> > --- a/arch/x86/mm/memtest.c
> > +++ b/arch/x86/mm/memtest.c
> > @@ -40,16 +40,14 @@ static void __init reserve_bad_mem(u64 pattern, u64 start_bad, u64 end_bad)
> >  
> >  static void __init memtest(u64 pattern, u64 start_phys, u64 size)
> >  {
> > -	u64 *p, *end;
> > -	void *start;
> > +	u64 *p, *start, *end;
> >  	u64 start_bad, last_bad;
> >  	u64 start_phys_aligned;
> > -	size_t incr;
> > +	const size_t incr = sizeof(pattern);

The const qualifier made the difference.


Thanks,

Andreas


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ