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/6444b828dc1d
branches:  trunk
changeset: 338703:6444b828dc1d
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 0562e508f750 -r 6444b828dc1d 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