Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari/stand/installboot fix strict aliasing violations



details:   https://anonhg.NetBSD.org/src/rev/cc3b39451097
branches:  trunk
changeset: 333683:cc3b39451097
user:      christos <christos%NetBSD.org@localhost>
date:      Thu Nov 13 17:19:29 2014 +0000

description:
fix strict aliasing violations

diffstat:

 sys/arch/atari/stand/installboot/installboot.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (30 lines):

diff -r 3f8cb30113d4 -r cc3b39451097 sys/arch/atari/stand/installboot/installboot.c
--- a/sys/arch/atari/stand/installboot/installboot.c    Thu Nov 13 16:51:53 2014 +0000
+++ b/sys/arch/atari/stand/installboot/installboot.c    Thu Nov 13 17:19:29 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: installboot.c,v 1.28 2014/03/31 06:32:31 ozaki-r Exp $ */
+/*     $NetBSD: installboot.c,v 1.29 2014/11/13 17:19:29 christos Exp $        */
 
 /*
  * Copyright (c) 1995 Waldi Ravens
@@ -467,6 +467,7 @@
     struct disklabel *label, u_int magic)
 {
        int              fd;
+       uint16_t         sum;
 
        memset(bb, 0, sizeof(*bb));
 
@@ -498,8 +499,10 @@
        setIDEpar(bb->bb_xxboot, sizeof(bb->bb_xxboot));
 
        /* set AHDI checksum */
-       *((u_int16_t *)bb->bb_xxboot + 255) = 0;
-       *((u_int16_t *)bb->bb_xxboot + 255) = 0x1234 - abcksum(bb->bb_xxboot);
+       sum = 0;
+       memcpy(bb->bb_xxboot + 255, &sum, sizeof(sum));
+       sum = 0x1234 - abcksum(bb->bb_xxboot);
+       memcpy(bb->bb_xxboot + 255, &sum, sizeof(sum));
 
        if (verbose) {
                printf("Primary   boot loader: %s\n", xxb);



Home | Main Index | Thread Index | Old Index