Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/sparc/stand/common dvma_init: avoid integer variabl...



details:   https://anonhg.NetBSD.org/src/rev/133c3b133440
branches:  trunk
changeset: 484895:133c3b133440
user:      pk <pk%NetBSD.org@localhost>
date:      Fri Apr 14 14:14:47 2000 +0000

description:
dvma_init: avoid integer variable overflow

diffstat:

 sys/arch/sparc/stand/common/dvma.c |  9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 4edc627b8aba -r 133c3b133440 sys/arch/sparc/stand/common/dvma.c
--- a/sys/arch/sparc/stand/common/dvma.c        Fri Apr 14 14:13:56 2000 +0000
+++ b/sys/arch/sparc/stand/common/dvma.c        Fri Apr 14 14:14:47 2000 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: dvma.c,v 1.5 2000/02/15 14:09:59 pk Exp $      */
+/*     $NetBSD: dvma.c,v 1.6 2000/04/14 14:14:47 pk Exp $      */
 /*
  * Copyright (c) 1995 Gordon W. Ross
  * All rights reserved.
@@ -59,14 +59,17 @@
 void
 dvma_init()
 {
-       int segva, dmava;
+       u_int segva, dmava;
+       int nseg;
        extern int start;
 
        /* Align our address base with the DVMA segment */
+       dmava = DVMA_BASE;
        base_va = segva = ((int)&start) & DVMA_BASE;
 
        /* Then double-map the DVMA adresses */
-       for (dmava = DVMA_BASE; dmava < DVMA_BASE + DVMA_MAPLEN; ) {
+       nseg = (DVMA_MAPLEN + NBPSG - 1) >> SGSHIFT;
+       while (nseg-- > 0) {
                setsegmap(dmava, getsegmap(segva));
                segva += NBPSG;
                dmava += NBPSG;



Home | Main Index | Thread Index | Old Index