瀏覽代碼

[arbel] Fix off-by-one error in the failure path in arbel_probe()

tags/v0.9.5
Michael Brown 16 年之前
父節點
當前提交
df02c54f86
共有 1 個文件被更改,包括 4 次插入4 次删除
  1. 4
    4
      src/drivers/infiniband/arbel.c

+ 4
- 4
src/drivers/infiniband/arbel.c 查看文件

@@ -2183,9 +2183,9 @@ static int arbel_probe ( struct pci_device *pci,
2183 2183
 
2184 2184
 	return 0;
2185 2185
 
2186
-	i = ( ARBEL_NUM_PORTS - 1 );
2186
+	i = ARBEL_NUM_PORTS;
2187 2187
  err_register_ibdev:
2188
-	for ( ; i >= 0 ; i-- )
2188
+	for ( i-- ; i >= 0 ; i-- )
2189 2189
 		unregister_ibdev ( arbel->ibdev[i] );
2190 2190
 	arbel_destroy_eq ( arbel );
2191 2191
  err_create_eq:
@@ -2201,9 +2201,9 @@ static int arbel_probe ( struct pci_device *pci,
2201 2201
  err_mailbox_out:
2202 2202
 	free_dma ( arbel->mailbox_in, ARBEL_MBOX_SIZE );
2203 2203
  err_mailbox_in:
2204
-	i = ( ARBEL_NUM_PORTS - 1 );
2204
+	i = ARBEL_NUM_PORTS;
2205 2205
  err_alloc_ibdev:
2206
-	for ( ; i >= 0 ; i-- )
2206
+	for ( i-- ; i >= 0 ; i-- )
2207 2207
 		ibdev_put ( arbel->ibdev[i] );
2208 2208
 	free ( arbel );
2209 2209
  err_alloc_arbel:

Loading…
取消
儲存