From: Wei Liu Subject: Re: [PATCH] blktap2: update connection handling to fix build with gcc5 Date: Mon, 20 Jul 2015 10:45:37 +0100 Message-ID: <20150720094537.GZ12455@zion.uk.xensource.com> References: <1437298408-23414-1-git-send-email-olaf@aepfle.de> <55ACD6CC0200007800092F33@mail.emea.novell.com> <20150720091634.GA4320@aepfle.de> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20150720091634.GA4320@aepfle.de> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Olaf Hering Cc: Wei Liu , Ian Campbell , Stefano Stabellini , Ian Jackson , xen-devel@lists.xen.org, Jan Beulich List-Id: xen-devel@lists.xenproject.org On Mon, Jul 20, 2015 at 11:16:34AM +0200, Olaf Hering wrote: > On Mon, Jul 20, Jan Beulich wrote: > > > >>> On 19.07.15 at 11:33, wrote: > > > [ 198s] block-log.c:549:23: error: array subscript is above array bounds [-Werror=array-bounds] > > > [ 198s] if (s->connections[i].id == id) > > > [ 198s] ^ > > > > So what makes the compiler right with that complaint? I.e. how does > > it know i > 0 here? After all - afaict - s->connected can only be 0 or > > It has to assume that ->connected can get any value because the input > comes from outside the unit. > > To reduce the patch size "&& i < MAX_CONNECTIONS" could be added. > A smaller patch would be preferable at this stage. Wei. > Olaf