mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-29 07:04:10 +08:00
Merge branch 'pci/resource'
- Restructure pci_dev_for_each_resource() to avoid computing the address of an out-of-bounds array element (the bounds check was performed later so the element was never actually *read*, but it's nicer to avoid even computing an out-of-bounds address) (Andy Shevchenko) * pci/resource: PCI: Avoid potential out-of-bounds read in pci_dev_for_each_resource()
This commit is contained in:
commit
5a4af2ca48
@ -2127,14 +2127,14 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma);
|
||||
(pci_resource_end((dev), (bar)) ? \
|
||||
resource_size(pci_resource_n((dev), (bar))) : 0)
|
||||
|
||||
#define __pci_dev_for_each_res0(dev, res, ...) \
|
||||
for (unsigned int __b = 0; \
|
||||
res = pci_resource_n(dev, __b), __b < PCI_NUM_RESOURCES; \
|
||||
#define __pci_dev_for_each_res0(dev, res, ...) \
|
||||
for (unsigned int __b = 0; \
|
||||
__b < PCI_NUM_RESOURCES && (res = pci_resource_n(dev, __b)); \
|
||||
__b++)
|
||||
|
||||
#define __pci_dev_for_each_res1(dev, res, __b) \
|
||||
for (__b = 0; \
|
||||
res = pci_resource_n(dev, __b), __b < PCI_NUM_RESOURCES; \
|
||||
#define __pci_dev_for_each_res1(dev, res, __b) \
|
||||
for (__b = 0; \
|
||||
__b < PCI_NUM_RESOURCES && (res = pci_resource_n(dev, __b)); \
|
||||
__b++)
|
||||
|
||||
#define pci_dev_for_each_resource(dev, res, ...) \
|
||||
|
Loading…
Reference in New Issue
Block a user