Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Validate that the configuration parameters that are...



details:   https://anonhg.NetBSD.org/src/rev/e7b718ef10c2
branches:  trunk
changeset: 365655:e7b718ef10c2
user:      kre <kre%NetBSD.org@localhost>
date:      Sun Aug 26 11:48:00 2018 +0000

description:
Validate that the configuration parameters that are supposed to
be numeric are in fact numeric, and then have the awk script use
them as awk numbers, rather than strings, so awk isn't doing string
comparisons on numbers (where "1024" < 2).

This has no effect with current configuratons, but would if anyone
had ever attempted to configure a system with nsysent >= 1000

diffstat:

 sys/kern/makesyscalls.sh |  21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diffs (56 lines):

diff -r a09c309975b6 -r e7b718ef10c2 sys/kern/makesyscalls.sh
--- a/sys/kern/makesyscalls.sh  Sun Aug 26 11:31:56 2018 +0000
+++ b/sys/kern/makesyscalls.sh  Sun Aug 26 11:48:00 2018 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: makesyscalls.sh,v 1.170 2018/08/10 21:44:59 pgoyette Exp $
+#      $NetBSD: makesyscalls.sh,v 1.171 2018/08/26 11:48:00 kre Exp $
 #
 # Copyright (c) 1994, 1996, 2000 Christopher G. Demetriou
 # All rights reserved.
@@ -78,6 +78,15 @@
 *)     . ./$1;;
 esac
 
+fail=false
+case "${nsysent:-0}" in
+*[!0-9]*) fail=true; printf >&2 '%s\n' "Non numeric value for nsysent";;
+esac
+case "${maxsysargs:-0}" in
+*[!0-9]*) fail=true; printf >&2 '%s\n' "Non numeric value for maxsysargs";;
+esac
+$fail && exit 1
+
 # tmp files:
 sysdcl="sysent.dcl"
 sysprotos="sys.protos"
@@ -172,7 +181,7 @@
        if (!registertype) {
            registertype = \"register_t\"
        }
-       nsysent = \"$nsysent\"
+       nsysent = ${nsysent:-0}
 
        sysdcl = \"$sysdcl\"
        syscompat_pref = \"$syscompat_pref\"
@@ -182,7 +191,7 @@
        rumpprotos = \"$rumpprotos\"
        rumptypes = \"$rumptypes\"
        sys_nosys = \"$sys_nosys\"
-       maxsysargs = \"$maxsysargs\"
+       maxsysargs = ${maxsysargs:-8}
        rumpnoflags=\"$rumpnoflags\"
        rumpnosys=\"$rumpnosys\"
        rumpnomodule=\"$rumpnomodule\"
@@ -1130,12 +1139,6 @@
 
        maxsyscall = syscall
 
-       # XXX
-       # XXX The following comparisons with nsysent will produce
-       # XXX unexpected results if (for example) syscall has a
-       # XXX value of 900 and nsysent has a value of "1024".  We
-       # XXX probably ought to make nsysent a numeric variable.
-       # XXX
        if (nsysent) {
                if (syscall > nsysent) {
                        printf("%s: line %d: too many syscalls [%d > %d]\n", infile, NR, syscall, nsysent)



Home | Main Index | Thread Index | Old Index