Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/cobalt/stand/boot Avoid type pruning.



details:   https://anonhg.NetBSD.org/src/rev/76bdcebf53e6
branches:  trunk
changeset: 795196:76bdcebf53e6
user:      joerg <joerg%NetBSD.org@localhost>
date:      Thu Apr 03 18:49:41 2014 +0000

description:
Avoid type pruning.

diffstat:

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

diffs (27 lines):

diff -r e1240859fb43 -r 76bdcebf53e6 sys/arch/cobalt/stand/boot/wd.c
--- a/sys/arch/cobalt/stand/boot/wd.c   Thu Apr 03 18:29:11 2014 +0000
+++ b/sys/arch/cobalt/stand/boot/wd.c   Thu Apr 03 18:49:41 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.15 2011/07/17 20:54:38 joerg Exp $    */
+/*     $NetBSD: wd.c,v 1.16 2014/04/03 18:49:41 joerg Exp $    */
 
 /*-
  * Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -157,6 +157,7 @@
        size_t rsize;
        struct disklabel *lp;
        uint8_t buf[DEV_BSIZE];
+       uint16_t magic;
 
        wdgetdefaultlabel(wd, &wd->sc_label);
 
@@ -167,7 +168,8 @@
        if (wdstrategy(wd, F_READ, MBR_BBSECTOR, DEV_BSIZE, buf, &rsize))
                return EOFFSET;
 
-       if (*(uint16_t *)&buf[MBR_MAGIC_OFFSET] == MBR_MAGIC) {
+       memcpy(&magic, &buf[MBR_MAGIC_OFFSET], sizeof(magic));
+       if (magic == MBR_MAGIC) {
                int i;
                struct mbr_partition *mp;
 



Home | Main Index | Thread Index | Old Index