Changeset 5f03107 in mainline
- Timestamp:
- 2018-05-22T19:06:50Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 659bd24
- Parents:
- 21ff054
- git-author:
- Jakub Jermar <jakub@…> (2018-04-25 19:39:19)
- git-committer:
- Jakub Jermar <jakub@…> (2018-05-22 19:06:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/virtio/virtio-pci.c
r21ff054 r5f03107 36 36 #include <pci_dev_iface.h> 37 37 38 static bool check_bar(virtio_dev_t *vdev, uint8_t bar) 38 static bool check_bar(virtio_dev_t *vdev, uint8_t bar, uint32_t offset, 39 uint32_t length) 39 40 { 40 41 /* We must ignore the capability if bar is greater than 5 */ … … 46 47 return false; 47 48 49 uintptr_t start = (uintptr_t) vdev->bar[bar].mapped_base; 50 if (start + offset < start) 51 return false; 52 if (start + offset > start + vdev->bar[bar].mapped_size) 53 return false; 54 if (start + offset + length < start + offset) 55 return false; 56 if (start + offset + length > start + vdev->bar[bar].mapped_size) 57 return false; 58 48 59 return true; 49 60 } … … 55 66 return; 56 67 57 if (!check_bar(vdev, bar ))68 if (!check_bar(vdev, bar, offset, length)) 58 69 return; 59 70 … … 69 80 return; 70 81 71 if (!check_bar(vdev, bar ))82 if (!check_bar(vdev, bar, offset, length)) 72 83 return; 73 84 … … 85 96 return; 86 97 87 if (!check_bar(vdev, bar ))98 if (!check_bar(vdev, bar, offset, length)) 88 99 return; 89 100 … … 99 110 return; 100 111 101 if (!check_bar(vdev, bar ))112 if (!check_bar(vdev, bar, offset, length)) 102 113 return; 103 114
Note:
See TracChangeset
for help on using the changeset viewer.