X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2Fgeneric.c;h=23f00ce753a5eaa932dffc049f6d1d07ba6856e8;hb=d22c11cec4e8c3390bfe6bf16ed07f5d073f0d4a;hp=ba2965f6d9fb27e9afc0ef0120a31536978cacdb;hpb=ff0fec756f4800fe869f3dff2f164d3ffcfc83e6;p=palacios.git diff --git a/palacios/src/devices/generic.c b/palacios/src/devices/generic.c index ba2965f..23f00ce 100644 --- a/palacios/src/devices/generic.c +++ b/palacios/src/devices/generic.c @@ -691,6 +691,7 @@ static int generic_init(struct v3_vm_info * vm, v3_cfg_tree_t * cfg) { memset(state, 0, sizeof(struct generic_internal)); strncpy(state->name,dev_id,MAX_NAME); + state->name[MAX_NAME-1] = 0; if (!forward) { state->forward_type=GENERIC_PHYSICAL; @@ -749,6 +750,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;