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:	Thu, 5 Dec 2013 20:13:47 -0500
From:	Theodore Ts'o <tytso@....edu>
To:	Greg Price <price@....EDU>
Cc:	linux-kernel@...r.kernel.org, Jiri Kosina <jkosina@...e.cz>,
	"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH 9/9] random: simplify accounting code

On Wed, Nov 13, 2013 at 03:08:41AM -0500, Greg Price wrote:
> +	entropy_count = max_t(int, 0,
> +			      entropy_count - (ibytes << (ENTROPY_SHIFT + 3)));
> +	if (ibytes && cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
> +		goto retry;

I wonder if we would be better dropping the test for ibytes here, so
the above condition reads:

	if (cmpxchg(&r->entropy_count, orig, entropy_count) != orig)
		goto retry;

It further simplifies the code, and it means that if we it turns out
that ibytes is zero (meaning there was no entropy available) but some
additional entropy comes in, we might acutally end up retrying and
successfully grabbing that entropy for the caller.

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