Source-Changes-HG archive

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

[src/trunk]: src/external/cddl/osnet/dist/lib/libdtrace/common Use a constant...



details:   https://anonhg.NetBSD.org/src/rev/d1f8aecc424c
branches:  trunk
changeset: 323144:d1f8aecc424c
user:      christos <christos%NetBSD.org@localhost>
date:      Sat Jun 02 01:19:46 2018 +0000

description:
Use a constant to prevent dynamic array allocation which messes up SSP.

diffstat:

 external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (31 lines):

diff -r f2c07a326d4a -r d1f8aecc424c external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c
--- a/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Fri Jun 01 22:11:53 2018 +0000
+++ b/external/cddl/osnet/dist/lib/libdtrace/common/dt_module.c Sat Jun 02 01:19:46 2018 +0000
@@ -1268,8 +1268,8 @@
 #ifdef __NetBSD__
        mapbase = 0;
        if (ismod) {
-               int maxmodules = 512;
-               modstat_t modstat_buf[maxmodules], *ms;
+#define        MAXMODULES 512
+               modstat_t modstat_buf[MAXMODULES], *ms;
                struct iovec iov = { modstat_buf, sizeof(modstat_buf) };
 
                if (modctl(MODCTL_STAT, &iov) < 0) {
@@ -1278,14 +1278,14 @@
                        return;
                }
 
-               for (i = 0; i < maxmodules; i++) {
+               for (i = 0; i < MAXMODULES; i++) {
                        ms = &modstat_buf[i];
                        if (!strcmp(name, ms->ms_name)) {
                                mapbase = ms->ms_addr;
                                break;
                        }
                }
-               if (i == maxmodules) {
+               if (i == MAXMODULES) {
                        dt_dprintf("module %s not found\n", name);
                        return;
                }



Home | Main Index | Thread Index | Old Index