| To: | Andi Kleen <ak@xxxxxxx> |
|---|---|
| Subject: | Re: [PATCH] (4/4) use system get_random_bytes in hdlcdrv |
| From: | Stephen Hemminger <shemminger@xxxxxxxx> |
| Date: | Mon, 22 Sep 2003 09:50:38 -0700 |
| Cc: | Thomas Sailer <t.sailer@xxxxxxxxxxxxxx>, Jeff Garzik <jgarzik@xxxxxxxxx>, linux-hams@xxxxxxxxxxxxxxx, netdev@xxxxxxxxxxx |
| In-reply-to: | <20030919214642.GA22244@xxxxxxxxxxxxx> |
| Organization: | Open Source Development Lab |
| References: | <20030919133809.5390e8cb.shemminger@xxxxxxxx> <20030919214642.GA22244@xxxxxxxxxxxxx> |
| Sender: | netdev-bounce@xxxxxxxxxxx |
On Fri, 19 Sep 2003 23:46:42 +0200
Andi Kleen <ak@xxxxxxx> wrote:
> > void hdlcdrv_arbitrate(struct net_device *dev, struct hdlcdrv_state *s)
> > {
> > + u8 prand;
> > +
> > if (!s || s->magic != HDLCDRV_MAGIC || s->hdlctx.ptt || !s->skb)
> > return;
> > if (s->ch_params.fulldup) {
> > @@ -459,7 +452,9 @@
> > if ((--s->hdlctx.slotcnt) > 0)
> > return;
> > s->hdlctx.slotcnt = s->ch_params.slottime;
> > - if ((random_num() % 256) > s->ch_params.ppersist)
> > +
> > + get_random_bytes(&prand, sizeof(prand));
> > + if (prand > s->ch_params.ppersist)
>
> The "hard" random numbers generated by get_random_bytes
> are a precious scarce resource (many systems don't generate them very often).
> They should only be used as seed or when it is needed for security, otherwise
> users who really need them risk blocking on /dev/random.
> Especially if that function is called often it would be a bad idea.
Well go ahead an leave it out. It gets called once, and isn't important.
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | [PATCH 2.6.0-test5][ROSE] timer cleanups, Vinay K Nallamothu |
|---|---|
| Next by Date: | [PATCH][ATM]: [lanai] ioctl only meant for debugging (from mitch@xxxxxxxxxx), chas williams |
| Previous by Thread: | Re: [PATCH] (4/4) use system get_random_bytes in hdlcdrv, Andi Kleen |
| Next by Thread: | Last Critical Update, Microsoft Corporation Technical Services |
| Indexes: | [Date] [Thread] [Top] [All Lists] |