Sfoglia il codice sorgente

[hermon] Fix off-by-one error in the failure path in hermon_probe()

tags/v0.9.5
Michael Brown 16 anni fa
parent
commit
76f6cad8af
1 ha cambiato i file con 4 aggiunte e 4 eliminazioni
  1. 4
    4
      src/drivers/infiniband/hermon.c

+ 4
- 4
src/drivers/infiniband/hermon.c Vedi File

@@ -2252,9 +2252,9 @@ static int hermon_probe ( struct pci_device *pci,
2252 2252
 
2253 2253
 	return 0;
2254 2254
 
2255
-	i = ( HERMON_NUM_PORTS - 1 );
2255
+	i = HERMON_NUM_PORTS;
2256 2256
  err_register_ibdev:
2257
-	for ( ; i >= 0 ; i-- )
2257
+	for ( i-- ; i >= 0 ; i-- )
2258 2258
 		unregister_ibdev ( hermon->ibdev[i] );
2259 2259
 	hermon_destroy_eq ( hermon );
2260 2260
  err_create_eq:
@@ -2270,9 +2270,9 @@ static int hermon_probe ( struct pci_device *pci,
2270 2270
  err_mailbox_out:
2271 2271
 	free_dma ( hermon->mailbox_in, HERMON_MBOX_SIZE );
2272 2272
  err_mailbox_in:
2273
-	i = ( HERMON_NUM_PORTS - 1 );
2273
+	i = HERMON_NUM_PORTS;
2274 2274
  err_alloc_ibdev:
2275
-	for ( ; i >= 0 ; i-- )
2275
+	for ( i-- ; i >= 0 ; i-- )
2276 2276
 		ibdev_put ( hermon->ibdev[i] );
2277 2277
 	free ( hermon );
2278 2278
  err_alloc_hermon:

Loading…
Annulla
Salva