lib/vmd: Fixed scan-build issue in vmd_pcibus_remove_device()

Added assertion checking if next element on list
is valid.

Change-Id: I9f4d969dc84e5fbee9d72d764f57fbd9480ab197
Signed-off-by: Wojciech Malikowski <wojciech.malikowski@intel.com>
Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/456774
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: Jim Harris <james.r.harris@intel.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
This commit is contained in:
Wojciech Malikowski 2019-06-04 04:48:25 -04:00 committed by Darek Stojaczyk
parent 57fe0394a3
commit 7a9ef7d2f6

View File

@ -419,6 +419,7 @@ vmd_pcibus_remove_device(vmd_pci_bus *bus, vmd_pci_device *device)
while (list->next != NULL) { while (list->next != NULL) {
if (list->next == device) { if (list->next == device) {
assert(list->next->next);
list->next = list->next->next; list->next = list->next->next;
} }
list = list->next; list = list->next;