On 13:41 Fri 02 Oct     , Hal Rosenstock wrote:
> 
> > diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
> > index 6f51404..aaab91a 100644
> > --- a/opensm/opensm/osm_mcast_mgr.c
> > +++ b/opensm/opensm/osm_mcast_mgr.c
> > @@ -1004,7 +1004,7 @@ static int mcast_mgr_set_mftables(osm_sm_t * sm)
> >        osm_switch_t *p_sw;
> >        osm_mcast_tbl_t *p_tbl;
> >        int block_notdone, ret = 0;
> > -       int16_t block_num, max_block = -1;
> > +       uint16_t block_num, max_block = -1;
> 
> Doesn't this change break the loop which uses block_num/max_block like:
> 
> for (block_num = 0; block_num <= max_block; block_num++) {
> ...

Yes, it breaks (I was too fast, sorry). The breakage is also catched by
Dale. The patch below should fix this.

Sasha

>From 0121a81ecb3124760817819cf170bb137523082c Mon Sep 17 00:00:00 2001
From: Sasha Khapyorsky <[email protected]>
Date: Sat, 3 Oct 2009 02:19:49 +0200
Subject: [PATCH] opensm: fix endless looping in mcast_mgr

The bug was introduced by broken signed -> unsigned conversion. Fix this
properly (including sign-compare warning).

Signed-off-by: Sasha Khapyorsky <[email protected]>
---
 opensm/include/opensm/osm_switch.h |    2 +-
 opensm/opensm/osm_mcast_mgr.c      |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opensm/include/opensm/osm_switch.h 
b/opensm/include/opensm/osm_switch.h
index e281842..37c1c4f 100644
--- a/opensm/include/opensm/osm_switch.h
+++ b/opensm/include/opensm/osm_switch.h
@@ -103,7 +103,7 @@ typedef struct osm_switch {
        uint8_t *lft;
        uint8_t *new_lft;
        osm_mcast_tbl_t mcast_tbl;
-       uint32_t mft_block_num;
+       int32_t mft_block_num;
        uint32_t mft_position;
        unsigned endport_links;
        unsigned need_update;
diff --git a/opensm/opensm/osm_mcast_mgr.c b/opensm/opensm/osm_mcast_mgr.c
index aaab91a..6f51404 100644
--- a/opensm/opensm/osm_mcast_mgr.c
+++ b/opensm/opensm/osm_mcast_mgr.c
@@ -1004,7 +1004,7 @@ static int mcast_mgr_set_mftables(osm_sm_t * sm)
        osm_switch_t *p_sw;
        osm_mcast_tbl_t *p_tbl;
        int block_notdone, ret = 0;
-       uint16_t block_num, max_block = -1;
+       int16_t block_num, max_block = -1;
 
        p_sw = (osm_switch_t *) cl_qmap_head(p_sw_tbl);
        while (p_sw != (osm_switch_t *) cl_qmap_end(p_sw_tbl)) {
-- 
1.6.5.rc1

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