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:	Tue, 25 Feb 2014 04:21:17 -0800
From:	Eric Dumazet <eric.dumazet@...il.com>
To:	David Laight <David.Laight@...LAB.COM>
Cc:	Stephen Hemminger <stephen@...workplumber.org>,
	Julian Anastasov <ja@....bg>,
	David Miller <davem@...emloft.net>,
	Yuchung Cheng <ycheng@...gle.com>,
	netdev <netdev@...r.kernel.org>,
	Neal Cardwell <ncardwell@...gle.com>,
	Larry Brakmo <brakmo@...gle.com>
Subject: RE: [PATCH v6 net-next 1/2] net: add skb_mstamp infrastructure

On Tue, 2014-02-25 at 09:51 +0000, David Laight wrote:

> 
> Do you need the union here?
> If you don't attempt to convert the value to a u64 then code
> is less likely to process it incorrectly.
> 

Check the second patch, it uses :

	first_ackt.v64 = 0;
...
	last_ackt = skb->skb_mstamp;
	if (!first_ackt.v64)
		first_ackt = last_ackt;

...

	skb_mstamp_get(&now);
	if (first_ackt.v64) {
        	seq_rtt_us = skb_mstamp_us_delta(&now, &first_ackt);
        	ca_seq_rtt_us = skb_mstamp_us_delta(&now, &last_ackt);
	}


Without the union, it would be more expensive on 64bit arches,
or relying on the compiler to be smart enough.

> Most modern ABI pass/return short structures in registers,
> so the actual code should be similar if you return the struct
> by value.

I am well aware of this, but this is a matter of taste, and I prefer
this more traditional way.



--
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