[openib-general] [PATCH 1 of 5] IB/mthca: fix off-by-one in FMR handling on memfree

Michael S. Tsirkin mst at mellanox.co.il
Wed Jan 3 04:46:30 PST 2007


There's an off-by-one in FMR handling on memfree hardware.

Example: assume we have 2 entries in scatterlist, 4K each, offset
is 4K.  current code will return first entry + 4K, where we
really want the second entry.

Signed-off-by: Michael S. Tsirkin <mst at mellanox.co.il>

---

Index: linux-2.6/drivers/infiniband/hw/mthca/mthca_memfree.c
===================================================================
--- linux-2.6.orig/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ linux-2.6/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -232,7 +232,7 @@ void *mthca_table_find(struct mthca_icm_
 
 	list_for_each_entry(chunk, &icm->chunk_list, list) {
 		for (i = 0; i < chunk->npages; ++i) {
-			if (chunk->mem[i].length >= offset) {
+			if (chunk->mem[i].length > offset) {
 				page = chunk->mem[i].page;
 				goto out;
 			}

-- 
MST




More information about the general mailing list