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:   Mon, 26 Sep 2016 15:53:57 +0200
From:   Hannes Frederic Sowa <hannes@...essinduktion.org>
To:     Maciej Żenczykowski <zenczykowski@...il.com>,
        Maciej Żenczykowski <maze@...gle.com>,
        "David S . Miller" <davem@...emloft.net>
Cc:     netdev@...r.kernel.org, Erik Kline <ek@...gle.com>,
        Lorenzo Colitti <lorenzo@...gle.com>
Subject: Re: [PATCH v4 5/7] ipv6 addrconf: implement RFC7559 router
 solicitation backoff

On 25.09.2016 13:03, Maciej Żenczykowski wrote:
> +static inline s32 rfc3315_s14_backoff_init(s32 initial)
> +{
> +	u32 r = (9 << 20) / 10 + (prandom_u32() % ((2 << 20) / 10 + 1));

^

> +	s32 v = initial * (u64)r >> 20;       /* ~ multiply by 0.9 .. 1.1 */
> +	return v;
> +}
> +
> +static inline s32 rfc3315_s14_backoff_update(s32 cur, s32 ceiling)
> +{
> +	u32 r = (19 << 20) / 10 + (prandom_u32() % ((2 << 20) / 10 + 1));

Please just use do_div here and go back to the first version of the
patch. Variable names could be more aligned with the RFC maybe?

> +	s32 v = cur * (u64)r >> 20;           /* ~ multiply by 1.9 .. 2.1 */
> +	if (v > ceiling) {
> +		r -= 1 << 20;
> +		v = ceiling * (u64)r >> 20;   /* ~ multiply by 0.9 .. 1.1 */
> +	}
> +	return v;
> +}

Thanks,
Hannes

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ