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: <1389468006.2537.72.camel@joe-AO722>
Date:	Sat, 11 Jan 2014 11:20:06 -0800
From:	Joe Perches <joe@...ches.com>
To:	Daniel Borkmann <dborkman@...hat.com>
Cc:	Hannes Frederic Sowa <hannes@...essinduktion.org>,
	Aruna-Hewapathirane <aruna.hewapathirane@...il.com>,
	netdev@...r.kernel.org
Subject: Re: [PATCH net-next] net: replace macros net_random and net_srandom
 with direct calls to prandom

On Sat, 2014-01-11 at 19:52 +0100, Daniel Borkmann wrote:
> On 01/11/2014 07:00 PM, Hannes Frederic Sowa wrote:
> > On Sat, Jan 11, 2014 at 09:52:37AM -0800, Joe Perches wrote:
> >> On Sat, 2014-01-11 at 07:15 -0500, Aruna-Hewapathirane wrote:
> >>> This patch removes the net_random and net_srandom macros and replaces
> >>> them with direct calls to the prandom ones. As new commits only seem to
> >>> use prandom_u32 there is no use to keep them around.
> >>> This change makes it easier to grep for users of prandom_u32.
> >>
> >> Seems sensible.
> >>
> >> Also, there may be some value in a future patch
> >> to use reciprocal_divide in a few places
> >>
> >>> diff --git a/net/802/garp.c b/net/802/garp.c
> >>> @@ -397,7 +397,7 @@ static void garp_join_timer_arm(struct garp_applicant *app)
> >>>   {
> >>>   	unsigned long delay;
> >>>
> >>> -	delay = (u64)msecs_to_jiffies(garp_join_time) * net_random() >> 32;
> >>> +	delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
> >>
> >> reciprocal_divide()
> >
> > Does reciprocal_divide() make sense without reciprocal_value() from a
> > stylish point of view?
> 
> No. ;-)
> 
> There was already some work, but I didn't have time to finish it:
> 
> http://www.spinics.net/lists/netdev/msg249395.html

I had forgotten about this.

> Maybe it's time that we should revisit that.

It'd be nice if you found some time to finish it.

	delay = (u64)msecs_to_jiffies(garp_join_time) * prandom_u32() >> 32;
vs
	delay = prandom_u32_max(msecs_to_jiffies(garp_join_time));
or
	delay = msecs_to_jiffies(prandom_u32_max(garp_join_time));

I think the first is harder to read.


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