Received: from eggs.gnu.org ([2001:4830:134:3::10]:49408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQJq-0000re-77 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZzQJn-00058Y-1z for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:14 -0500 Received: from mx2.suse.de ([195.135.220.15]:42938) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZzQJm-000587-R6 for qemu-devel@nongnu.org; Thu, 19 Nov 2015 09:36:10 -0500 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Thu, 19 Nov 2015 15:35:59 +0100 Message-Id: <1447943768-31393-2-git-send-email-afaerber@suse.de> In-Reply-To: <1447943768-31393-1-git-send-email-afaerber@suse.de> References: <1447943768-31393-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PULL v2 01/10] qdev: Change Property::offset field to ptrdiff_t type List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Ildar Isaev , =?UTF-8?q?Andreas=20F=C3=A4rber?= From: Ildar Isaev Property::offset field is calculated as a diff between two pointers: arrayprop->prop.offset =3D eltptr - (void *)dev; If offset is declared as int, this subtraction can cause type overflow, thus leading to failure of the subsequent assertion: assert(qdev_get_prop_ptr(dev, &arrayprop->prop) =3D=3D eltptr); So ptrdiff_t should be used instead. Signed-off-by: Ildar Isaev Reviewed-by: Peter Maydell Signed-off-by: Andreas F=C3=A4rber --- include/hw/qdev-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e6dbde4..c537969 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -237,7 +237,7 @@ struct BusState { struct Property { const char *name; PropertyInfo *info; - int offset; + ptrdiff_t offset; uint8_t bitnr; qtype_code qtype; int64_t defval; --=20 2.6.2