Module Name:    src
Committed By:   mrg
Date:           Mon Jul  4 12:03:56 UTC 2011

Modified Files:
        src/sys/arch/mmeye/stand/boot: wd.c

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


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/mmeye/stand/boot/wd.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/mmeye/stand/boot/wd.c
diff -u src/sys/arch/mmeye/stand/boot/wd.c:1.1 src/sys/arch/mmeye/stand/boot/wd.c:1.2
--- src/sys/arch/mmeye/stand/boot/wd.c:1.1	Thu Mar  3 05:59:37 2011
+++ src/sys/arch/mmeye/stand/boot/wd.c	Mon Jul  4 12:03:56 2011
@@ -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)

Reply via email to