From: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
To: linux-rdma <linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Cc: Dale Purdy <purdy-sJ/iWh9BUns@public.gmane.org>,
Hal Rosenstock
<hal.rosenstock-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Subject: [PATCH] opensm/osm_qos_parser_y.y: fix endless loop
Date: Sat, 3 Oct 2009 03:15:59 +0200 [thread overview]
Message-ID: <20091003011559.GE17846@me> (raw)
In-Reply-To: <20091003003357.GD17846@me>
Fix endless loop introduced by signed --> unsigned conversion (was done
for compilation warning fix). Reimplement __parser_strip_white() in
slightly shorter variant without explicit index.
Signed-off-by: Sasha Khapyorsky <sashak-smomgflXvOZWk0Htik3J/w@public.gmane.org>
---
opensm/opensm/osm_qos_parser_y.y | 25 +++++++++++--------------
1 files changed, 11 insertions(+), 14 deletions(-)
diff --git a/opensm/opensm/osm_qos_parser_y.y b/opensm/opensm/osm_qos_parser_y.y
index 7a2ce13..95e420e 100644
--- a/opensm/opensm/osm_qos_parser_y.y
+++ b/opensm/opensm/osm_qos_parser_y.y
@@ -2394,20 +2394,17 @@ static void yyerror(const char *format, ...)
static char * __parser_strip_white(char * str)
{
- unsigned int i;
- for (i = (strlen(str)-1); i >= 0; i--)
- {
- if (isspace(str[i]))
- str[i] = '\0';
- else
- break;
- }
- for (i = 0; i < strlen(str); i++)
- {
- if (!isspace(str[i]))
- break;
- }
- return &(str[i]);
+ char *p;
+
+ while (isspace(*str))
+ str++;
+ if (!*str)
+ return str;
+ p = str + strlen(str) - 1;
+ while (isspace(*p))
+ *p-- = '\0';
+
+ return str;
}
/***************************************************
--
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
prev parent reply other threads:[~2009-10-03 1:15 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
2009-10-03 1:15 ` Sasha Khapyorsky [this message]
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=20091003011559.GE17846@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 \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox