From: Kyle Hale Date: Tue, 26 Aug 2014 18:04:19 +0000 (-0500) Subject: prevent oops in generic device when port mode not correctly provided X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=commitdiff_plain;h=675206650bb9a05023c0e53a1e0c21aa1f375f88 prevent oops in generic device when port mode not correctly provided --- diff --git a/palacios/src/devices/generic.c b/palacios/src/devices/generic.c index ba2965f..bf4adc4 100644 --- a/palacios/src/devices/generic.c +++ b/palacios/src/devices/generic.c @@ -749,6 +749,10 @@ static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { uint16_t start = atox(v3_cfg_val(port_cfg, "start")); uint16_t end = atox(v3_cfg_val(port_cfg, "end")); char * mode_str = v3_cfg_val(port_cfg, "mode"); + if (!mode_str) { + PrintError(vm, VCORE_NONE, "generic (%s): error getting port mode\n", state->name); + return -1; + } generic_mode_t mode = GENERIC_IGNORE; if (strcasecmp(mode_str, "print_and_ignore") == 0) { mode = GENERIC_PRINT_AND_IGNORE;