[ofa-general] [PATCH] for-23 ib/local_sa: adjust data offset by attribute offset, not size

Sean Hefty sean.hefty at intel.com
Mon Jul 16 11:03:06 PDT 2007


I merged the patch below with the local_sa patch in my for-roland branch.
It's shown below separately for review purposes only.

The fix is based on code review, versus an observed bug.  (Since a
path record is 64 bytes, it's almost guaranteed that the size and
offset will be the same.)

- Sean


We should adjust the data offset by the attribute offset, and
not the size of the attribute.  The attribute offset includes
any necessary padding between the attributes.

Signed-off-by: Sean Hefty <sean.hefty at intel.com>
---

 drivers/infiniband/core/local_sa.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/core/local_sa.c b/drivers/infiniband/core/local_sa.c
index 6c073a3..75545a5 100644
--- a/drivers/infiniband/core/local_sa.c
+++ b/drivers/infiniband/core/local_sa.c
@@ -369,11 +369,11 @@ static void *ib_sa_iter_next(struct ib_sa_mad_iter *iter)
 				/* copy the second piece of the attribute */
 				memcpy(iter->attr + offset, &mad->data[0],
 				       iter->attr_size - offset);
-				iter->data_offset = iter->attr_size - offset;
+				iter->data_offset = iter->attr_offset - offset;
 				offset = 0;
 			} else {
 				iter->attr = &mad->data[iter->data_offset];
-				iter->data_offset += iter->attr_size;
+				iter->data_offset += iter->attr_offset;
 			}
 
 			iter->data_left -= iter->attr_offset;




More information about the general mailing list