linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] opensm/complib/cl_ptr_vector.c: fix bug/compiler warning
@ 2010-02-02 13:29 Yevgeny Kliteynik
       [not found] ` <4B6828B6.5050005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Yevgeny Kliteynik @ 2010-02-02 13:29 UTC (permalink / raw)
  To: Sasha Khapyorsky; +Cc: Linux RDMA

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 <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
---
 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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] opensm/complib/cl_ptr_vector.c: fix bug/compiler warning
       [not found] ` <4B6828B6.5050005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
@ 2010-02-03 12:28   ` Sasha Khapyorsky
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Khapyorsky @ 2010-02-03 12:28 UTC (permalink / raw)
  To: Yevgeny Kliteynik; +Cc: Linux RDMA

On 15:29 Tue 02 Feb     , Yevgeny Kliteynik wrote:
> 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 <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>

Applied. Thanks.

Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-02-03 12:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-02-02 13:29 [PATCH] opensm/complib/cl_ptr_vector.c: fix bug/compiler warning Yevgeny Kliteynik
     [not found] ` <4B6828B6.5050005-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
2010-02-03 12:28   ` Sasha Khapyorsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).