Coverity flagged that hvm_next_io_handler() will return NULL after
calling domain_crash() and this will then lead to NULL pointer
dereferences in calling functions.
This patch checks for NULL in the callers and bails in that case.
Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
{
struct hvm_io_handler *handler = hvm_next_io_handler(d);
+ if ( handler == NULL )
+ return;
+
handler->type = IOREQ_TYPE_COPY;
handler->ops = &mmio_ops;
handler->mmio.ops = ops;
{
struct hvm_io_handler *handler = hvm_next_io_handler(d);
+ if ( handler == NULL )
+ return;
+
handler->type = IOREQ_TYPE_PIO;
handler->ops = &portio_ops;
handler->portio.port = port;
{
struct hvm_io_handler *handler = hvm_next_io_handler(d);
+ if ( handler == NULL )
+ return;
+
handler->type = IOREQ_TYPE_PIO;
handler->ops = &dpci_portio_ops;
}
/* VGA memory */
handler = hvm_next_io_handler(d);
+
+ if ( handler == NULL )
+ return;
+
handler->type = IOREQ_TYPE_COPY;
handler->ops = &stdvga_mem_ops;
}