Update qemu package to mitigate CVE-2015-3456
[packages/centos6/qemu.git] / 0003-vmstate-add-VMSTATE_VALIDATE.patch
1 From d9e0cb134eefe5104b404b91eaf969a2cd74bd9f Mon Sep 17 00:00:00 2001
2 From: "Michael S. Tsirkin" <mst@redhat.com>
3 Date: Thu, 3 Apr 2014 19:50:35 +0300
4 Subject: [PATCH] vmstate: add VMSTATE_VALIDATE
5
6 Validate state using VMS_ARRAY with num = 0 and VMS_MUST_EXIST
7
8 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
9 Signed-off-by: Juan Quintela <quintela@redhat.com>
10 (cherry picked from commit 4082f0889ba04678fc14816c53e1b9251ea9207e)
11 ---
12  include/migration/vmstate.h | 8 ++++++++
13  1 file changed, 8 insertions(+)
14
15 diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
16 index de970ab..5b71370 100644
17 --- a/include/migration/vmstate.h
18 +++ b/include/migration/vmstate.h
19 @@ -204,6 +204,14 @@ extern const VMStateInfo vmstate_info_bitmap;
20      .offset       = vmstate_offset_value(_state, _field, _type),     \
21  }
22  
23 +/* Validate state using a boolean predicate. */
24 +#define VMSTATE_VALIDATE(_name, _test) { \
25 +    .name         = (_name),                                         \
26 +    .field_exists = (_test),                                         \
27 +    .flags        = VMS_ARRAY | VMS_MUST_EXIST,                      \
28 +    .num          = 0, /* 0 elements: no data, only run _test */     \
29 +}
30 +
31  #define VMSTATE_POINTER(_field, _state, _version, _info, _type) {    \
32      .name       = (stringify(_field)),                               \
33      .version_id = (_version),                                        \