Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/atari/atari Fix another possible out of bounds.



details:   https://anonhg.NetBSD.org/src/rev/8e5c9216ca70
branches:  trunk
changeset: 321304:8e5c9216ca70
user:      tsutsui <tsutsui%NetBSD.org@localhost>
date:      Sat Mar 10 02:48:51 2018 +0000

description:
Fix another possible out of bounds.

diffstat:

 sys/arch/atari/atari/pmap_bootstrap.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (34 lines):

diff -r 38ca8fc2246a -r 8e5c9216ca70 sys/arch/atari/atari/pmap_bootstrap.c
--- a/sys/arch/atari/atari/pmap_bootstrap.c     Fri Mar 09 22:27:15 2018 +0000
+++ b/sys/arch/atari/atari/pmap_bootstrap.c     Sat Mar 10 02:48:51 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pmap_bootstrap.c,v 1.8 2016/12/22 14:47:54 cherry Exp $        */
+/*     $NetBSD: pmap_bootstrap.c,v 1.9 2018/03/10 02:48:51 tsutsui Exp $       */
 /*-
  * Copyright (c) 1999 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -113,11 +113,11 @@
        /*
         * Setup physical address ranges
         */
-       for (i = 0; usable_segs[i + 1].start; i++)
-               ;
+       for (i = 0; i < NMEM_SEGS && usable_segs[i].start; i++)
+               continue;
        /* XXX: allow for msgbuf */
-       usable_segs[i].end -= m68k_round_page(MSGBUFSIZE);
-       msgbufpa = usable_segs[i].end;
+       usable_segs[i - 1].end -= m68k_round_page(MSGBUFSIZE);
+       msgbufpa = usable_segs[i - 1].end;
 
        /*
         * Count physical memory
@@ -132,7 +132,7 @@
        /*
         * Announce available memory to the VM-system
         */
-       for (i = 0; usable_segs[i].start; i++)
+       for (i = 0; i < NMEM_SEGS && usable_segs[i].start; i++)
                uvm_page_physload(atop(usable_segs[i].start),
                                 atop(usable_segs[i].end),
                                 atop(usable_segs[i].start),



Home | Main Index | Thread Index | Old Index