Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mmeye/stand/boot convert a cast & structure assignm...



details:   https://anonhg.NetBSD.org/src/rev/b0ba3f2eb1ca
branches:  trunk
changeset: 766934:b0ba3f2eb1ca
user:      mrg <mrg%NetBSD.org@localhost>
date:      Mon Jul 04 12:03:56 2011 +0000

description:
convert a cast & structure assignment to a memcpy() to avoid
potential pointer aliasing issues.

diffstat:

 sys/arch/mmeye/stand/boot/wd.c |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diffs (18 lines):

diff -r ea2958865900 -r b0ba3f2eb1ca sys/arch/mmeye/stand/boot/wd.c
--- a/sys/arch/mmeye/stand/boot/wd.c    Mon Jul 04 12:01:56 2011 +0000
+++ b/sys/arch/mmeye/stand/boot/wd.c    Mon Jul 04 12:03:56 2011 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.1 2011/03/03 05:59:37 kiyohara Exp $  */
+/*     $NetBSD: wd.c,v 1.2 2011/07/04 12:03:56 mrg Exp $       */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
        if ((error = wdc_exec_identify(wd, buf)) != 0)
                return error;
 
-       wd->sc_params = *(struct ataparams *)buf;
+       memcpy(&wd->sc_params, buf, sizeof wd->sc_params);
 
        /* 48-bit LBA addressing */
        if ((wd->sc_params.atap_cmd2_en & ATA_CMD2_LBA48) != 0)



Home | Main Index | Thread Index | Old Index