mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "George Spelvin" <linux@horizon.com>
To: dborkman@redhat.com, linux@horizon.com
Cc: davem@davemloft.net, hannes@stressinduktion.org,
	linux-kernel@vger.kernel.org, shemminger@osdl.org, tytso@mit.edu
Subject: Re: [PATCH 4/7] lib/random32.c: Use <asm/unaligned.h> instead of hand-rolling it
Date: 8 Jun 2014 08:40:31 -0400	[thread overview]
Message-ID: <20140608124031.2571.qmail@ns.horizon.com> (raw)
In-Reply-To: <53945633.20702@redhat.com>

> Seems fine by me, since it's random anyway archs might not care
> about the *_le32, though this might yield additional work in some
> cases I presume.

If you think that's okay, sure.  I kept it consistent to get byte-for-byte
identical results.

If variations in that are allowed, that can also
simplify the trailing storage case:

+		if (bytes & 2)
+			put_unaligned_le16((u16)random, p+i);
+		if (bytes & 1)
+			p[i+bytes-1] = (u8)(random >> 16);

>> +	for (i = 0; i < round_down(bytes, sizeof(u32)); i += sizeof(u32))
>> +		put_unaligned_le32(prandom_u32_state(state), p+i);

> Nit: 'p + i'

I don't really care, but I'm happy without the spaces; I add them
to show what binds more weakly, and in this case that's the
argument-separating comma.

>> +		p[i] = (u8)random;

> Nit: '(u8) random'

Actually, my style and most of the kerel is to not put
a space in a cast, since it binds so tighty.

E.g. compare

git grep ')[a-z]' kernel/
git grep ') [a-z]' kernel/

Notice that the second is alsmost all comments.
(There are some spaces in kernel/ptrace.v.)

I'd rather leave it without the space unless you feel
very strongly about it.

  reply	other threads:[~2014-06-08 12:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-07  8:18 [PATCH 0/7] random32: Various minor cleanups George Spelvin
2014-06-07  8:19 ` [PATCH 1/7] lib/random32.c: Mark self-test data as __initconst George Spelvin
2014-06-08 12:06   ` Daniel Borkmann
2014-06-07  8:20 ` [PATCH 2/7] lib/random32.c: Remove excess calls to prandom_u32_state in initialization George Spelvin
2014-06-08 12:11   ` Daniel Borkmann
2014-06-08 12:19     ` George Spelvin
2014-06-07  8:22 ` [PATCH 3/7] lib/random32.c: Replace an #ifdef with a stub prandom_state_selftest() George Spelvin
2014-06-08 12:16   ` Daniel Borkmann
2014-06-08 12:27     ` George Spelvin
2014-06-07  8:25 ` [PATCH 4/7] lib/random32.c: Use <asm/unaligned.h> instead of hand-rolling it George Spelvin
2014-06-08 12:25   ` Daniel Borkmann
2014-06-08 12:40     ` George Spelvin [this message]
2014-06-08 20:26       ` Hannes Frederic Sowa
2014-06-10 15:13       ` Daniel Borkmann
2014-06-07  8:28 ` [PATCH 5/7] lib/random32.c: Make prandom_u32_max efficient for powers of 2 George Spelvin
2014-06-08 12:03   ` Daniel Borkmann
2014-06-08 17:34   ` Hannes Frederic Sowa
2014-06-08 20:02     ` Daniel Borkmann
2014-06-09  0:28       ` George Spelvin
2014-06-08 20:48     ` George Spelvin
2014-06-09 10:30       ` Hannes Frederic Sowa
2014-06-07  8:28 ` [PATCH 6/7] lib/random32.c: Randomize timeout to the millisecond, not the second George Spelvin
2014-06-08 10:43   ` Daniel Borkmann
2014-06-08 11:30     ` George Spelvin
2014-06-08 12:28       ` Daniel Borkmann
2014-06-08 12:42         ` George Spelvin
2014-06-08 20:01           ` Daniel Borkmann
2014-06-07  8:31 ` [PATCH 7/7] lib/random32.c: Remove redundant U suffixes on integers George Spelvin
2014-06-08 10:36   ` Daniel Borkmann
2014-06-08 11:14     ` George Spelvin
2014-06-08 12:05       ` Daniel Borkmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140608124031.2571.qmail@ns.horizon.com \
    --to=linux@horizon.com \
    --cc=davem@davemloft.net \
    --cc=dborkman@redhat.com \
    --cc=hannes@stressinduktion.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=shemminger@osdl.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®