From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:46119) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwRCw-00031g-Fm for qemu-devel@nongnu.org; Wed, 11 Nov 2015 03:58:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZwRB5-0000uY-TU for qemu-devel@nongnu.org; Wed, 11 Nov 2015 03:56:46 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60434) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZwRB5-0000uN-PF for qemu-devel@nongnu.org; Wed, 11 Nov 2015 03:54:51 -0500 From: Markus Armbruster References: <1425478186-18894-1-git-send-email-ild@inbox.ru> <87io83jvug.fsf@blackfin.pond.sub.org> Date: Wed, 11 Nov 2015 09:54:47 +0100 In-Reply-To: (Peter Maydell's message of "Tue, 25 Aug 2015 15:32:40 +0100") Message-ID: <87wptohq5k.fsf@blackfin.pond.sub.org> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Qemu-devel] [PATCH] include/hw: field 'offset' in struct Property should be ptrdiff_t as int causes overflow List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Ildar Isaev , QEMU Developers , Anthony Liguori , Andreas =?utf-8?Q?F=C3=A4rber?= Peter Maydell writes: > On 25 August 2015 at 15:17, Markus Armbruster wrote: >> Stumbled over this while throwing away old mail. Andreas, what do you >> think? > > Seems right to me -- I suspect the original properties code was > written with the assumption that the property field would be > inside the device struct (and so offsets are small). The array > properties code breaks that assumption by allocating a separate > lump of memory with the properties in it; so now there's no > guarantee that the two pointers being subtracted will be > within 4G of each other. > > Reviewed-by: Peter Maydell > > Arguably for consistency the 'arrayoffset' struct member should > also be a ptrdiff_t, though our current uses of it are such > that it'll always be within int range. Andreas?