Source-Changes-HG archive

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

[src/trunk]: src/usr.sbin/installboot/arch Compute bootloader checksum correc...



details:   https://anonhg.NetBSD.org/src/rev/9239de072b1e
branches:  trunk
changeset: 808845:9239de072b1e
user:      mlelstv <mlelstv%NetBSD.org@localhost>
date:      Fri Jun 05 05:02:48 2015 +0000

description:
Compute bootloader checksum correctly also on little endian systems.

diffstat:

 usr.sbin/installboot/arch/amiga.c |  10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)

diffs (38 lines):

diff -r 1b640d9ce306 -r 9239de072b1e usr.sbin/installboot/arch/amiga.c
--- a/usr.sbin/installboot/arch/amiga.c Fri Jun 05 00:53:47 2015 +0000
+++ b/usr.sbin/installboot/arch/amiga.c Fri Jun 05 05:02:48 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $        */
+/*     $NetBSD: amiga.c,v 1.9 2015/06/05 05:02:48 mlelstv Exp $        */
 
 /*-
  * Copyright (c) 1999, 2002 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if !defined(__lint)
-__RCSID("$NetBSD: amiga.c,v 1.8 2013/06/14 03:54:43 msaitoh Exp $");
+__RCSID("$NetBSD: amiga.c,v 1.9 2015/06/05 05:02:48 mlelstv Exp $");
 #endif /* !__lint */
 
 #include <sys/param.h>
@@ -126,8 +126,8 @@
                }
                (void)strncpy(dline, params->command, CMDLN_LEN-1);
 
-               block[1] = 0;
-               block[1] = 0xffffffff - chksum(block, sumlen);
+               block[1] = htobe32(0);
+               block[1] = htobe32(0xffffffff - chksum(block, sumlen));
        }
 
        if (params->flags & IB_NOWRITE) {
@@ -164,7 +164,7 @@
 
        for (i=0; i<size; i++) {
                lastsum = sum;
-               sum += htobe32(block[i]);
+               sum += be32toh(block[i]);
                if (sum < lastsum)
                        ++sum;
        }



Home | Main Index | Thread Index | Old Index