Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/mac68k/mac68k convert 'extern long intrnames' to 'e...



details:   https://anonhg.NetBSD.org/src/rev/79f08c1a8cf3
branches:  trunk
changeset: 449016:79f08c1a8cf3
user:      mrg <mrg%NetBSD.org@localhost>
date:      Tue Feb 19 00:34:50 2019 +0000

description:
convert 'extern long intrnames' to 'extern char intrnames[MAX_INAME_LENGTH]'.
also, assert that MAX_INAME_LENGTH is not larger than eintrnames - intrnames.

fixes gcc 7's object size checker checks.  tested by martin@.

diffstat:

 sys/arch/mac68k/mac68k/intr.c |  13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diffs (49 lines):

diff -r b4cc1a1c4abe -r 79f08c1a8cf3 sys/arch/mac68k/mac68k/intr.c
--- a/sys/arch/mac68k/mac68k/intr.c     Tue Feb 19 00:30:16 2019 +0000
+++ b/sys/arch/mac68k/mac68k/intr.c     Tue Feb 19 00:34:50 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: intr.c,v 1.29 2010/12/20 00:25:36 matt Exp $   */
+/*     $NetBSD: intr.c,v 1.30 2019/02/19 00:34:50 mrg Exp $    */
 
 /*-
  * Copyright (c) 1996, 1997 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.29 2010/12/20 00:25:36 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: intr.c,v 1.30 2019/02/19 00:34:50 mrg Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -100,9 +100,9 @@
 void
 intr_init(void)
 {
-       extern long     intrnames;
+       extern char     intrnames[MAX_INAME_LENGTH];
+       extern char     eintrnames[] __diagused;
        const char      *inames;
-       char            *g_inames;
 
        ipl2psl_table[IPL_NONE]       = 0;
        ipl2psl_table[IPL_SOFTCLOCK]  = PSL_S|PSL_IPL1;
@@ -111,7 +111,6 @@
        ipl2psl_table[IPL_SOFTBIO]    = PSL_S|PSL_IPL1;
        ipl2psl_table[IPL_HIGH]       = PSL_S|PSL_IPL7;
 
-       g_inames = (char *) &intrnames;
        if (mac68k_machine.aux_interrupts) {
                inames = AUX_INAMES;
 
@@ -132,7 +131,9 @@
                }
        }
 
-       memcpy(g_inames, inames, MAX_INAME_LENGTH);
+       KASSERT(MAX_INAME_LENGTH <=
+               ((uintptr_t)eintrnames - (uintptr_t)intrnames));
+       memcpy(intrnames, inames, MAX_INAME_LENGTH);
 
        intr_computeipl();
 



Home | Main Index | Thread Index | Old Index