From 6350b0904615cc0531cc3059ea34db5c009c88aa Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 2 Feb 2012 16:19:21 +0100 Subject: qdev: fix off-by-one Integer properties did not work. Reviewed-by: Anthony Liguori Signed-off-by: Paolo Bonzini --- hw/qdev-properties.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'hw') diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c index d69a987b86..debb37f4fb 100644 --- a/hw/qdev-properties.c +++ b/hw/qdev-properties.c @@ -151,7 +151,7 @@ static void set_int8(Object *obj, Visitor *v, void *opaque, error_propagate(errp, local_err); return; } - if (value > prop->info->min && value <= prop->info->max) { + if (value >= prop->info->min && value <= prop->info->max) { *ptr = value; } else { error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, @@ -259,7 +259,7 @@ static void set_int16(Object *obj, Visitor *v, void *opaque, error_propagate(errp, local_err); return; } - if (value > prop->info->min && value <= prop->info->max) { + if (value >= prop->info->min && value <= prop->info->max) { *ptr = value; } else { error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, @@ -333,7 +333,7 @@ static void set_int32(Object *obj, Visitor *v, void *opaque, error_propagate(errp, local_err); return; } - if (value > prop->info->min && value <= prop->info->max) { + if (value >= prop->info->min && value <= prop->info->max) { *ptr = value; } else { error_set(errp, QERR_PROPERTY_VALUE_OUT_OF_RANGE, -- cgit v1.2.3