mirror of
https://review.haiku-os.org/haiku
synced 2025-01-18 04:28:52 +01:00
virtio_pci: in setup_queue(), only check queue number on v1 devices
* fix #18962
* bus->queue_count wasn't initialized yet so the check could succeed
or not, depending on the init value for memory: on release, 0 mostly,
on nightly, a non-zero value.
Change-Id: Id745932e8171abe3b8b78a3e9b2f2058c9507f7a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8618
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>
Haiku-Format: Haiku-format Bot <no-reply+haikuformatbot@haiku-os.org>
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
(cherry picked from commit d866277547
)
Reviewed-on: https://review.haiku-os.org/c/haiku/+/8638
This commit is contained in:
parent
4687fe0566
commit
61c8617edd
@ -417,10 +417,9 @@ setup_queue(void* cookie, uint16 queue, phys_addr_t phy, phys_addr_t phyAvail,
|
||||
{
|
||||
CALLED();
|
||||
virtio_pci_sim_info* bus = (virtio_pci_sim_info*)cookie;
|
||||
if (queue >= bus->queue_count)
|
||||
return B_BAD_VALUE;
|
||||
|
||||
if (bus->virtio1) {
|
||||
if (queue >= bus->queue_count)
|
||||
return B_BAD_VALUE;
|
||||
volatile uint16* queueSelect = (uint16*)(bus->commonCfgAddr
|
||||
+ offsetof(struct virtio_pci_common_cfg, queue_select));
|
||||
*queueSelect = queue;
|
||||
@ -603,6 +602,7 @@ init_bus(device_node* node, void** bus_cookie)
|
||||
if (bus == NULL) {
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
memset(bus, 0, sizeof(virtio_pci_sim_info));
|
||||
|
||||
pci_device_module_info* pci;
|
||||
pci_device* device;
|
||||
@ -694,7 +694,8 @@ init_bus(device_node* node, void** bus_cookie)
|
||||
|
||||
volatile uint16 *queueCount = (uint16*)(bus->commonCfgAddr
|
||||
+ offsetof(struct virtio_pci_common_cfg, num_queues));
|
||||
bus->notifyOffsets = new addr_t[*queueCount];
|
||||
bus->queue_count = *queueCount;
|
||||
bus->notifyOffsets = new addr_t[bus->queue_count];
|
||||
|
||||
} else {
|
||||
// legacy interrupt
|
||||
|
Loading…
Reference in New Issue
Block a user