diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-02 16:19:21 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-02-07 13:52:42 +0100 |
commit | 6350b0904615cc0531cc3059ea34db5c009c88aa (patch) | |
tree | 3646e9d2999b26b62cf1b7d3f25123fb0ee34289 /hw | |
parent | dd0ba250ca83ed915ea192ab7539cdbb4e868c14 (diff) |
qdev: fix off-by-one
Integer properties did not work.
Reviewed-by: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/qdev-properties.c | 6 |
1 files changed, 3 insertions, 3 deletions
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, |