diff options
author | dd <dd@FreeBSD.org> | 2001-05-27 00:57:25 +0000 |
---|---|---|
committer | dd <dd@FreeBSD.org> | 2001-05-27 00:57:25 +0000 |
commit | 7efd4f631e966bb4264560adae393ea771412f96 (patch) | |
tree | 02a30beff17991aee8e6f551f6ee2246f5cb4234 /sys/dev/syscons | |
parent | 1b6b8f296eaf8070940373861171398bed15ab72 (diff) | |
download | FreeBSD-src-7efd4f631e966bb4264560adae393ea771412f96.zip FreeBSD-src-7efd4f631e966bb4264560adae393ea771412f96.tar.gz |
In the VIRTUAL_TTY macro, add a check to make sure that the result of
SC_DEV isn't NULL; if it is, evaluate to NULL and don't dereference
NULL. Callers of VIRTUAL_TTY must already check for the result being
NULL since si_tty can be NULL, so this should be safe.
This fixes a panic when trying to switch to a different vty in an
environment such as userconfig (-c option to the kernel).
PR: 26508
Diffstat (limited to 'sys/dev/syscons')
-rw-r--r-- | sys/dev/syscons/syscons.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/dev/syscons/syscons.c b/sys/dev/syscons/syscons.c index f3305c4..685b992 100644 --- a/sys/dev/syscons/syscons.c +++ b/sys/dev/syscons/syscons.c @@ -124,7 +124,8 @@ SYSCTL_INT(_machdep, OID_AUTO, enable_panic_key, CTLFLAG_RW, &enable_panic_key, #define SC_CONSOLECTL 255 -#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x))->si_tty) +#define VIRTUAL_TTY(sc, x) (SC_DEV((sc), (x)) != NULL ? \ + SC_DEV((sc), (x))->si_tty : NULL) static int debugger; |