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
This commit is contained in:
Dima Dorfman 2001-05-27 00:57:25 +00:00
parent 84d337151e
commit 83d94cdf69

View File

@ -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;