From 3b6ca4022d150ad273d4cd9556c2f4873389f965 Mon Sep 17 00:00:00 2001 From: Ildar Isaev Date: Wed, 4 Mar 2015 17:09:46 +0300 Subject: qdev: Change Property::offset field to ptrdiff_t type MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Property::offset field is calculated as a diff between two pointers: arrayprop->prop.offset = 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) == eltptr); So ptrdiff_t should be used instead. Signed-off-by: Ildar Isaev Reviewed-by: Peter Maydell Signed-off-by: Andreas Färber --- include/hw/qdev-core.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'include') 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; -- cgit v1.1