Source-Changes-HG archive

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

[src/trunk]: src/sbin/disklabel Fix botch in "make disklabel a MI tool" chang...



details:   https://anonhg.NetBSD.org/src/rev/f3999a18585b
branches:  trunk
changeset: 339375:f3999a18585b
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Fri Jul 17 20:30:21 2015 +0000

description:
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.

Should be pulled up to netbsd-7.

diffstat:

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

diffs (18 lines):

diff -r b096381d6442 -r f3999a18585b sbin/disklabel/bswap.c
--- a/sbin/disklabel/bswap.c    Fri Jul 17 20:29:29 2015 +0000
+++ b/sbin/disklabel/bswap.c    Fri Jul 17 20:30:21 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.3 2015/07/17 20:30:21 tsutsui Exp $        */
 
 /*-
  * Copyright (c) 2009 Izumi Tsutsui.  All rights reserved.
@@ -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