From: Ildar Isaev Date: Wed, 4 Mar 2015 14:09:46 +0000 (+0300) Subject: qdev: Change Property::offset field to ptrdiff_t type X-Git-Tag: v2.5.0-rc1~2^2~9 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3b6ca4022d150ad273d4cd9556c2f4873389f965;p=thirdparty%2Fqemu.git qdev: Change Property::offset field to ptrdiff_t type 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 --- diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index e6dbde42c46..c537969f4ee 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;