From 6459496b69862695dfd126549c1cc495da7db418 Mon Sep 17 00:00:00 2001 From: Neel Natu Date: Sat, 4 Aug 2012 04:24:41 +0000 Subject: [PATCH] Check that 'opts' is actually not NULL before dereferencing it. It is expected that 'opts' will be NULL for the second serial port (-S ,uart) --- usr.sbin/bhyve/pci_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/usr.sbin/bhyve/pci_uart.c b/usr.sbin/bhyve/pci_uart.c index 1cb485e64b07..0f8a28131db2 100644 --- a/usr.sbin/bhyve/pci_uart.c +++ b/usr.sbin/bhyve/pci_uart.c @@ -580,7 +580,7 @@ pci_uart_init(struct vmctx *ctx, struct pci_devinst *pi, char *opts) pci_emul_alloc_bar(pi, 0, bar, PCIBAR_IO, 8); pci_lintr_request(pi, ivec); - if (!strcmp("stdio", opts) && !pci_uart_stdio) { + if (opts != NULL && !strcmp("stdio", opts) && !pci_uart_stdio) { pci_uart_stdio = 1; sc->stdio = 1; }