From: Ian Campbell <ian.campbell@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>,
Olaf Hering <olaf@aepfle.de>,
xen-devel@lists.xen.org, Wei Liu <wei.liu2@citrix.com>,
Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Subject: Re: [PATCH v2] blktap2: update connection handling to fix build with gcc5
Date: Tue, 21 Jul 2015 09:52:44 +0100 [thread overview]
Message-ID: <1437468764.17368.83.camel@citrix.com> (raw)
In-Reply-To: <55AE236D020000780009386A@prv-mh.provo.novell.com>
On Tue, 2015-07-21 at 02:48 -0600, Jan Beulich wrote:
> >>> On 21.07.15 at 10:42, <olaf@aepfle.de> wrote:
> > --- a/tools/blktap2/drivers/block-log.c
> > +++ b/tools/blktap2/drivers/block-log.c
> > @@ -359,7 +359,7 @@ static int ctl_close_sock(struct tdlog_state* s, int fd)
> > {
> > int i;
> >
> > - for (i = 0; i < s->connected; i++) {
> > + for (i = 0; i < s->connected && i < MAX_CONNECTIONS; i++) {
> > if (s->connections[i].fd == fd) {
> > tapdisk_server_unregister_event(s->connections[i].id);
> > close(s->connections[i].fd);
> > @@ -545,7 +545,7 @@ static inline int ctl_find_connection(struct tdlog_state *s, event_id_t id)
> > {
> > int i;
> >
> > - for (i = 0; i < s->connected; i++)
> > + for (i = 0; i < s->connected && i < MAX_CONNECTIONS; i++)
> > if (s->connections[i].id == id)
> > return s->connections[i].fd;
> >
>
> Which now makes the reader (wrongly) imply that s->connected
> might be equal to or larger than MAX_CONNECTIONS.
I was just thinking that perhaps either an assert() or an:
if ( s->connected >= MAX_CONNECTIONS ) {
log
return error
}
might be more appropriate.
Ian.
prev parent reply other threads:[~2015-07-21 8:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-21 8:42 [PATCH v2] blktap2: update connection handling to fix build with gcc5 Olaf Hering
2015-07-21 8:48 ` Jan Beulich
2015-07-21 8:52 ` Ian Campbell [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=1437468764.17368.83.camel@citrix.com \
--to=ian.campbell@citrix.com \
--cc=JBeulich@suse.com \
--cc=ian.jackson@eu.citrix.com \
--cc=olaf@aepfle.de \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.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.