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]
Message-Id: <1177452915.30986.61.camel@localhost.localdomain>
Date:	Wed, 25 Apr 2007 00:15:15 +0200
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Stephen Hemminger <shemminger@...ux-foundation.org>
Cc:	YOSHIFUJI Hideaki /
	 吉藤英明 
	<yoshfuji@...ux-ipv6.org>, dada1@...mosbay.com, bunk@...sta.de,
	davem@...emloft.net, netdev@...r.kernel.org
Subject: Re: [PATCH] Fix build errors on 32bit platforms with new ktime

On Tue, 2007-04-24 at 14:57 -0700, Stephen Hemminger wrote:
> On Wed, 25 Apr 2007 06:55:39 +0900 (JST)
> YOSHIFUJI Hideaki / 吉藤英明  <yoshfuji@...ux-ipv6.org> wrote:
> 
> > In article <20070424100420.2860db68@...l.pdx.osdl.net> (at Tue, 24 Apr 2007 10:04:20 -0700), Stephen Hemminger <shemminger@...ux-foundation.org> says:
> > 
> > > Yoshifuji-san had the right idea, but ktime_to_us needs to be defined
> > > in a way that works on both 64 and 32bit platforms.
> > 
> > No, this does not cure.
> > >  
> > > +#define ktime_to_us(kt)			((kt).tv64 / NSEC_PER_SEC)
> > > +
> > 
> > NSEC_PER_USEC?
> 
> On 64 bit platforms, ktime stores nano-seconds in a 64 bit value, so
> this is correct.

Err, nsec_value / NSEC_PER_SEC results in seconds AFAICS

nsec_value / NSEC_PER_USEC gives you microseconds

> > 
> > > +static inline s64 ktime_to_us(const ktime_t kt)
> > > +{
> > > +	return (s64) kt.tv_sec * USEC_PER_SEC + kt.tv_nsec / NSEC_PER_USEC;
> > > +}
> > > +
> > 
> > Please do NOT use division here, which was the source of the
> > linkage error, and the reason why I posted a patch to use
> > ktime_to_timeval().
> 
> On 32 bit platforms, ktime stores as two 32 bit values. Therefore the
> division is only 32bit and therefore okay.

Nope.

#if BITS_PER_LONG != 64 && !defined(CONFIG_KTIME_SCALAR)
....

and on i386

config KTIME_SCALAR
        bool
        default y

so you take the 

ktime_to_timeval is probably the right way for it.

	tglx


-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ