From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: Hal Rosenstock <hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
Dale Purdy <purdy-sJ/iWh9BUns@public.gmane.org>,
"Stan C. Smith"
<stan.smith-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH] opensm: fix some obvious -Wsign-compare warnings
Date: Sat, 3 Oct 2009 02:33:57 +0200 [thread overview]
Message-ID: <20091003003357.GD17846@me> (raw)
In-Reply-To: <f0e08f230910021041p28307726j6bb280220abd1eae-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
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 <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
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 <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
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 majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2009-10-03 0:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-01 19:25 [PATCH] opensm: fix some obvious -Wsign-compare warnings Sasha Khapyorsky
2009-10-02 17:41 ` Hal Rosenstock
[not found] ` <f0e08f230910021041p28307726j6bb280220abd1eae-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2009-10-03 0:33 ` Sasha Khapyorsky [this message]
2009-10-03 1:15 ` [PATCH] opensm/osm_qos_parser_y.y: fix endless loop Sasha Khapyorsky
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20091003003357.GD17846@me \
--to=sashak-smomgflxvozwk0htik3j/w@public.gmane.org \
--cc=hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=purdy-sJ/iWh9BUns@public.gmane.org \
--cc=stan.smith-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.