From: Michael S. Tsirkin Date: Thu, 15 Dec 2005 21:55:50 +0000 (-0800) Subject: IB/mthca: Fix thinko in mthca_table_find() X-Git-Tag: v2.6.16.28-rc1~2037^2~17 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=6c7d2a75b512c64c910b69adf32dbaddb461910b;p=karo-tx-linux.git IB/mthca: Fix thinko in mthca_table_find() break only escapes from the innermost loop, and we want to escape both loops and return an answer. Noticed by Ishai Rabinovitch. Signed-off-by: Michael S. Tsirkin Signed-off-by: Roland Dreier --- diff --git a/drivers/infiniband/hw/mthca/mthca_memfree.c b/drivers/infiniband/hw/mthca/mthca_memfree.c index 5798ed00d83d..9fb985a016e9 100644 --- a/drivers/infiniband/hw/mthca/mthca_memfree.c +++ b/drivers/infiniband/hw/mthca/mthca_memfree.c @@ -233,7 +233,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj) for (i = 0; i < chunk->npages; ++i) { if (chunk->mem[i].length >= offset) { page = chunk->mem[i].page; - break; + goto out; } offset -= chunk->mem[i].length; }