Bläddra i källkod

[vmxnet3] Check for ioremap() failures

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 10 år sedan
förälder
incheckning
7ab3035749
1 ändrade filer med 10 tillägg och 0 borttagningar
  1. 10
    0
      src/drivers/net/vmxnet3.c

+ 10
- 0
src/drivers/net/vmxnet3.c Visa fil

@@ -602,8 +602,16 @@ static int vmxnet3_probe ( struct pci_device *pci ) {
602 602
 	/* Map PCI BARs */
603 603
 	vmxnet->pt = ioremap ( pci_bar_start ( pci, VMXNET3_PT_BAR ),
604 604
 			       VMXNET3_PT_LEN );
605
+	if ( ! vmxnet->pt ) {
606
+		rc = -ENODEV;
607
+		goto err_ioremap_pt;
608
+	}
605 609
 	vmxnet->vd = ioremap ( pci_bar_start ( pci, VMXNET3_VD_BAR ),
606 610
 			       VMXNET3_VD_LEN );
611
+	if ( ! vmxnet->vd ) {
612
+		rc = -ENODEV;
613
+		goto err_ioremap_vd;
614
+	}
607 615
 
608 616
 	/* Version check */
609 617
 	if ( ( rc = vmxnet3_check_version ( vmxnet ) ) != 0 )
@@ -633,7 +641,9 @@ static int vmxnet3_probe ( struct pci_device *pci ) {
633 641
  err_reset:
634 642
  err_check_version:
635 643
 	iounmap ( vmxnet->vd );
644
+ err_ioremap_vd:
636 645
 	iounmap ( vmxnet->pt );
646
+ err_ioremap_pt:
637 647
 	netdev_nullify ( netdev );
638 648
 	netdev_put ( netdev );
639 649
  err_alloc_etherdev:

Laddar…
Avbryt
Spara