summaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
diff options
context:
space:
mode:
authorNikita Danilov2019-02-27 13:10:07 +0100
committerDavid S. Miller2019-03-02 01:45:15 +0100
commit13b7997a103d90a2174ab93abefe3c9376bb97e5 (patch)
tree51f6339501202ca07f8c9ac019d0cae110d9dfdf /drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
parentnet: aquantia: added newline at end of file (diff)
downloadkernel-qcow2-linux-13b7997a103d90a2174ab93abefe3c9376bb97e5.tar.gz
kernel-qcow2-linux-13b7997a103d90a2174ab93abefe3c9376bb97e5.tar.xz
kernel-qcow2-linux-13b7997a103d90a2174ab93abefe3c9376bb97e5.zip
net: aquantia: fixed buffer overflow
The overflow is detected by smatch: drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c: 175 aq_pci_func_free_irqs() error: buffer overflow 'self->aq_vec' 8 <= 31 In reality msix_entry_mask always restricts number of iterations. Adding extra condition to make logic clear and smatch happy. Signed-off-by: Nikita Danilov <nikita.danilov@aquantia.com> Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c')
-rw-r--r--drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
index c8b44cdb91c1..0217ff4669a4 100644
--- a/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
@@ -170,6 +170,8 @@ void aq_pci_func_free_irqs(struct aq_nic_s *self)
for (i = 32U; i--;) {
if (!((1U << i) & self->msix_entry_mask))
continue;
+ if (i >= AQ_CFG_VECS_MAX)
+ continue;
if (pdev->msix_enabled)
irq_set_affinity_hint(pci_irq_vector(pdev, i), NULL);