Revision 295587f7
b/hw/virtio-serial-bus.c | ||
---|---|---|
402 | 402 |
{ |
403 | 403 |
VirtIOSerial *s = opaque; |
404 | 404 |
VirtIOSerialPort *port; |
405 |
uint32_t max_nr_ports, nr_active_ports; |
|
405 |
uint32_t max_nr_ports, nr_active_ports, nr_ports;
|
|
406 | 406 |
unsigned int i; |
407 | 407 |
|
408 | 408 |
if (version_id > 2) { |
... | ... | |
419 | 419 |
/* The config space */ |
420 | 420 |
qemu_get_be16s(f, &s->config.cols); |
421 | 421 |
qemu_get_be16s(f, &s->config.rows); |
422 |
s->config.nr_ports = qemu_get_be32(f); |
|
422 |
nr_ports = qemu_get_be32(f); |
|
423 |
|
|
424 |
if (nr_ports != s->config.nr_ports) { |
|
425 |
/* |
|
426 |
* Source hot-plugged/unplugged ports and we don't have all of |
|
427 |
* them here. |
|
428 |
* |
|
429 |
* Note: This condition cannot check for all hotplug/unplug |
|
430 |
* events: eg, if one port was hot-plugged and one was |
|
431 |
* unplugged, the nr_ports remains the same but the port id's |
|
432 |
* would have changed and we won't catch it here. A later |
|
433 |
* check for !find_port_by_id() will confirm if this happened. |
|
434 |
*/ |
|
435 |
return -EINVAL; |
|
436 |
} |
|
423 | 437 |
|
424 | 438 |
/* Items in struct VirtIOSerial */ |
425 | 439 |
|
Also available in: Unified diff