1
0
mirror of https://github.com/projectacrn/acrn-hypervisor.git synced 2025-05-02 13:44:00 +00:00

DM: Fix the NULL cfg_write for virtio_console

Otherwise it will trigger the seg fault when the virtio_console is based
on MSI.

Signed-off-by: Zagacki Paul <paul.zagacki@intel.com>
Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
This commit is contained in:
Zhao Yakui 2019-12-10 15:15:16 +08:00
parent b7cce16403
commit cd003d5e4a

View File

@ -805,8 +805,8 @@ bad:
if (cr != NULL) {
/* offset must be OK, so size must be bad */
fprintf(stderr,
"%s: read from %s: bad size %d\r\n",
name, cr->name, size);
"%s: read from %s: bad size %d instead of %d\r\n",
name, cr->name, size, cr->size);
} else {
fprintf(stderr,
"%s: read from bad offset/size %jd/%d\r\n",
@ -905,8 +905,13 @@ virtio_pci_legacy_write(struct vmctx *ctx, int vcpu, struct pci_vdev *dev,
max = vops->cfgsize ? vops->cfgsize : 0x100000000;
if (newoff + size > max)
goto bad;
error = (*vops->cfgwrite)(DEV_STRUCT(base), newoff,
if(vops->cfgwrite == NULL) {
//printf("%s: offset %ld cfg size %ld\tcannot write config\r\n", __func__, offset, virtio_config_size);
error = 1; /* want to proceed */
} else {
error = (*vops->cfgwrite)(DEV_STRUCT(base), newoff,
size, value);
}
if (!error)
goto done;
}