Source-Changes-HG archive

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

[src/netbsd-7]: src/sbin/disklabel Pull up following revision(s) (requested b...



details:   https://anonhg.NetBSD.org/src/rev/2b83cfb935bc
branches:  netbsd-7
changeset: 799503:2b83cfb935bc
user:      martin <martin%NetBSD.org@localhost>
date:      Thu Jul 30 09:45:24 2015 +0000

description:
Pull up following revision(s) (requested by tsutsui in ticket #891):
        sbin/disklabel/bswap.c: revision 1.3-1.4

Fix botch in "make disklabel a MI tool" changes in rev 1.2.

After that chanage, "MAXPARTITIONS" constant is not for the target port.
If host's MAXPARTITIONS is larger than a value of the target label and
target endianness is different from the build host, bswaplabel() could
overwrite data beyond the disklabel and primary boot stored after
LABELSECTOR in images might be corrupted.

This fixes boot failure of sun2 liveimage built by
"build.sh -U -m sun2 release live-image"
on TME.

Fix build.

diffstat:

 sbin/disklabel/bswap.c |  6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diffs (27 lines):

diff -r 5fee72059b9c -r 2b83cfb935bc sbin/disklabel/bswap.c
--- a/sbin/disklabel/bswap.c    Thu Jul 30 09:37:37 2015 +0000
+++ b/sbin/disklabel/bswap.c    Thu Jul 30 09:45:24 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bswap.c,v 1.2 2013/05/03 16:05:12 matt Exp $   */
+/*     $NetBSD: bswap.c,v 1.2.6.1 2015/07/30 09:45:24 martin Exp $     */
 
 /*-
  * Copyright (c) 2009 Izumi Tsutsui.  All rights reserved.
@@ -74,7 +74,7 @@
 static void
 bswaplabel(struct disklabel *nlp, const struct disklabel *olp)
 {
-       int i;
+       u_int i;
 
        nlp->d_magic          = bswap32(olp->d_magic);
        nlp->d_type           = bswap16(olp->d_type);
@@ -120,7 +120,7 @@
        nlp->d_bbsize         = bswap32(olp->d_bbsize);
        nlp->d_sbsize         = bswap32(olp->d_sbsize);
 
-       for (i = 0; i < MAXPARTITIONS; i++) {
+       for (i = 0; i < maxpartitions; i++) {
                nlp->d_partitions[i].p_size =
                    bswap32(olp->d_partitions[i].p_size);
                nlp->d_partitions[i].p_offset =



Home | Main Index | Thread Index | Old Index