[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v1 3/3] blktap2: Silence warnings under GCC 5.1.1
On 03/10/15 19:39, Konrad Rzeszutek Wilk wrote: > I get compile warnings telling me that > s->connections[i].fd == fd > > 'i' may be past the array. Adding in an extra condition > on the loop fixes that. > > Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Furthermore, I can't see any logic which prevents s->connected getting larger than MAX_CONNECTIONS > --- > tools/blktap2/drivers/block-log.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/blktap2/drivers/block-log.c > b/tools/blktap2/drivers/block-log.c > index 5330cdc..1934227 100644 > --- 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; > _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |