Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src/sys/kern Pull up following revision(s) (requested by rias...
details: https://anonhg.NetBSD.org/src/rev/2c7f0e63fcb3
branches: netbsd-7
changeset: 798226:2c7f0e63fcb3
user: martin <martin%NetBSD.org@localhost>
date: Mon Aug 11 15:38:27 2014 +0000
description:
Pull up following revision(s) (requested by riastradh in ticket #4):
sys/kern/kern_rndq.c: revision 1.27
sys/kern/kern_rndpool.c: revision 1.7
buf is not guaranteed to be aligned; don't *(uint32_t *) it.
done is not guaranteed to be aligned; don't *(uint32_t *) it.
diffstat:
sys/kern/kern_rndpool.c | 7 +++----
sys/kern/kern_rndq.c | 12 +++++++-----
2 files changed, 10 insertions(+), 9 deletions(-)
diffs (75 lines):
diff -r 1940d80e1ab2 -r 2c7f0e63fcb3 sys/kern/kern_rndpool.c
--- a/sys/kern/kern_rndpool.c Mon Aug 11 15:36:45 2014 +0000
+++ b/sys/kern/kern_rndpool.c Mon Aug 11 15:38:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndpool.c,v 1.6 2014/08/10 16:44:36 tls Exp $ */
+/* $NetBSD: kern_rndpool.c,v 1.6.2.1 2014/08/11 15:38:27 martin Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.6 2014/08/10 16:44:36 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndpool.c,v 1.6.2.1 2014/08/11 15:38:27 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -212,8 +212,7 @@
buf = p;
for (; len > 3; len -= 4) {
- val = *((const u_int32_t *)buf);
-
+ (void)memcpy(&val, buf, 4);
rndpool_add_one_word(rp, val);
buf += 4;
}
diff -r 1940d80e1ab2 -r 2c7f0e63fcb3 sys/kern/kern_rndq.c
--- a/sys/kern/kern_rndq.c Mon Aug 11 15:36:45 2014 +0000
+++ b/sys/kern/kern_rndq.c Mon Aug 11 15:38:27 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kern_rndq.c,v 1.26 2014/08/11 04:26:53 riastradh Exp $ */
+/* $NetBSD: kern_rndq.c,v 1.26.2.1 2014/08/11 15:38:27 martin Exp $ */
/*-
* Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.26 2014/08/11 04:26:53 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_rndq.c,v 1.26.2.1 2014/08/11 15:38:27 martin Exp $");
#include <sys/param.h>
#include <sys/atomic.h>
@@ -816,7 +816,8 @@
u_int32_t entropy, uint32_t ts)
{
rnd_sample_t *state = NULL;
- const uint32_t *dint = data;
+ const uint8_t *p = data;
+ uint32_t dint;
int todo, done, filled = 0;
int sample_count;
SIMPLEQ_HEAD(, _rnd_sample_t) tmp_samples =
@@ -828,7 +829,7 @@
RND_FLAG_COLLECT_VALUE))))) {
return;
}
- todo = len / sizeof(*dint);
+ todo = len / sizeof(dint);
/*
* Let's try to be efficient: if we are warm, and a source
* is adding entropy at a rate of at least 1 bit every 10 seconds,
@@ -874,7 +875,8 @@
}
state->ts[state->cursor] = ts;
- state->values[state->cursor] = dint[done];
+ (void)memcpy(&dint, &p[done*4], 4);
+ state->values[state->cursor] = dint;
state->cursor++;
if (state->cursor == sample_count) {
Home |
Main Index |
Thread Index |
Old Index