Hi Sasha,

Fixing a bug in cl_ptr_vector_find_from_end(), discovered
by compiler's warning:

cl_ptr_vector.c: In function 'cl_ptr_vector_find_from_end':
cl_ptr_vector.c:305: warning: operation on 'i' may be undefined

Signed-off-by: Yevgeny Kliteynik <[email protected]>
---
 opensm/complib/cl_ptr_vector.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/opensm/complib/cl_ptr_vector.c b/opensm/complib/cl_ptr_vector.c
index 8ccb9f0..36db4db 100644
--- a/opensm/complib/cl_ptr_vector.c
+++ b/opensm/complib/cl_ptr_vector.c
@@ -302,7 +302,8 @@ size_t cl_ptr_vector_find_from_end(IN const cl_ptr_vector_t 
* const p_vector,

        while (i) {
                /* Invoke the callback for the current element. */
-               if (pfn_callback(i, (void *)p_vector->p_ptr_array[--i],
+               i--;
+               if (pfn_callback(i, (void *)p_vector->p_ptr_array[i],
                                 (void *)context) == CL_SUCCESS) {
                        return (i);
                }
-- 
1.5.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to