From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52682) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFHe-00059J-2O for qemu-devel@nongnu.org; Tue, 25 Aug 2015 10:33:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZUFHY-0001W4-Qo for qemu-devel@nongnu.org; Tue, 25 Aug 2015 10:33:05 -0400 Received: from mail-vk0-f52.google.com ([209.85.213.52]:33144) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZUFHY-0001Vs-N3 for qemu-devel@nongnu.org; Tue, 25 Aug 2015 10:33:00 -0400 Received: by vkd66 with SMTP id 66so74018049vkd.0 for ; Tue, 25 Aug 2015 07:33:00 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <87io83jvug.fsf@blackfin.pond.sub.org> References: <1425478186-18894-1-git-send-email-ild@inbox.ru> <87io83jvug.fsf@blackfin.pond.sub.org> From: Peter Maydell Date: Tue, 25 Aug 2015 15:32:40 +0100 Message-ID: Content-Type: text/plain; charset=UTF-8 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: Markus Armbruster Cc: Ildar Isaev , QEMU Developers , Anthony Liguori , =?UTF-8?Q?Andreas_F=C3=A4rber?= 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. -- PMM