Skip to contentSkip to conversation

opensm/complib/cl_ptr_vector.c: fix bug/compiler warning

PATCH Applied Yevgeny Kliteynik 2 participants 2 messages Feb 2, 2010 – Feb 3, 2010 1 message not in the archive InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 opensm/complib/cl_ptr_vector.c: fix bug/compiler warning

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

---
 opensm/complib/cl_ptr_vector.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
opensm/complib/cl_ptr_vector.c +2 -1
index 8ccb9f0..36db4db 100644
@@ -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);
 		}
Signature · 6 lines
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

A message that is not in the archive (sent off-list or not yet received): 4B6828B6.5050005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org

#2 lore raw
Quoted 9 lines · Yevgeny Kliteynik

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

Applied. Thanks.

Sasha
--
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