[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120418064202.GA27966@ritirata.org>
Date: Wed, 18 Apr 2012 08:42:03 +0200
From: Antonio Quartulli <ordex@...istici.org>
To: David Miller <davem@...emloft.net>
Cc: netdev@...r.kernel.org, b.a.t.m.a.n@...ts.open-mesh.org,
lindner_marek@...oo.de
Subject: Re: [PATCH 03/11] batman-adv: randomize initial seqno to avoid
collision
On Tue, Apr 17, 2012 at 10:45:27 -0400, David Miller wrote:
> From: Antonio Quartulli <ordex@...istici.org>
> Date: Tue, 17 Apr 2012 13:58:19 +0200
>
> > @@ -33,6 +33,11 @@
> > static void bat_iv_ogm_iface_enable(struct hard_iface *hard_iface)
> > {
> > struct batman_ogm_packet *batman_ogm_packet;
> > + unsigned long random_seqno;
> > +
> > + /* randomize initial seqno to avoid collision */
> > + get_random_bytes(&random_seqno, sizeof(unsigned long));
> > + atomic_set(&hard_iface->seqno, (uint32_t)random_seqno);
>
> This is silly.
>
> Just use "uint32_t" for the type of random_seqno and the sizeof passed
> to get_random_bytes.
>
> And here comes the magic part.
>
> Amazing, no ugly and pointless casts needed!
I agree :-)
Thank you for the suggestion.
Cheers,
--
Antonio Quartulli
..each of us alone is worth nothing..
Ernesto "Che" Guevara
Content of type "application/pgp-signature" skipped
Powered by blists - more mailing lists