Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern buf is not guaranteed to be aligned; don't *(uint32...



details:   https://anonhg.NetBSD.org/src/rev/8d35aea395d5
branches:  trunk
changeset: 801617:8d35aea395d5
user:      riastradh <riastradh%NetBSD.org@localhost>
date:      Mon Aug 11 13:59:24 2014 +0000

description:
buf is not guaranteed to be aligned; don't *(uint32_t *) it.

diffstat:

 sys/kern/kern_rndpool.c |  7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (28 lines):

diff -r 22ed2336e69d -r 8d35aea395d5 sys/kern/kern_rndpool.c
--- a/sys/kern/kern_rndpool.c   Mon Aug 11 13:40:34 2014 +0000
+++ b/sys/kern/kern_rndpool.c   Mon Aug 11 13:59:24 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.7 2014/08/11 13:59:24 riastradh 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.7 2014/08/11 13:59:24 riastradh 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;
        }



Home | Main Index | Thread Index | Old Index