diff options
| author | Machon Gregory <mbgrego@tycho.nsa.gov> | 2016-02-01 11:54:23 -0500 |
|---|---|---|
| committer | Bruce Ashfield <bruce.ashfield@windriver.com> | 2016-02-01 15:33:30 -0500 |
| commit | 47260c0059dd8f999db2c9ae2fad460d8f779a33 (patch) | |
| tree | b963fcc92434a3f1f0fd0f829884e8cd79a9aec5 | |
| parent | f5649753869888606de09701ea9f9a56424cd3d8 (diff) | |
| download | meta-virtualization-47260c0059dd8f999db2c9ae2fad460d8f779a33.tar.gz | |
Allow xsm to be built with GCC 5.1.1 and greater
The patch was cherrypicked from upstream Xen. See patch header for more information.
Signed-off-by: Machon Gregory <mbgrego@tycho.nsa.gov>
Signed-off-by: Bruce Ashfield <bruce.ashfield@windriver.com>
| -rw-r--r-- | recipes-extended/xen/files/xen-xsm-Make-p-policyvers-be-a-local-variable-ver-to.patch | 122 | ||||
| -rw-r--r-- | recipes-extended/xen/xen_4.6.0.bb | 1 |
2 files changed, 123 insertions, 0 deletions
diff --git a/recipes-extended/xen/files/xen-xsm-Make-p-policyvers-be-a-local-variable-ver-to.patch b/recipes-extended/xen/files/xen-xsm-Make-p-policyvers-be-a-local-variable-ver-to.patch new file mode 100644 index 00000000..efe6e748 --- /dev/null +++ b/recipes-extended/xen/files/xen-xsm-Make-p-policyvers-be-a-local-variable-ver-to.patch | |||
| @@ -0,0 +1,122 @@ | |||
| 1 | From 6a2f81459e1455d65a9a6f78dd2a0d0278619680 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
| 3 | Date: Wed, 16 Sep 2015 15:57:27 -0400 | ||
| 4 | Subject: [PATCH] xen/xsm: Make p->policyvers be a local variable (ver) to shut | ||
| 5 | up GCC 5.1.1 warnings. | ||
| 6 | MIME-Version: 1.0 | ||
| 7 | Content-Type: text/plain; charset=UTF-8 | ||
| 8 | Content-Transfer-Encoding: 8bit | ||
| 9 | |||
| 10 | policydb.c: In function ‘user_read’: | ||
| 11 | policydb.c:1443:26: error: ‘buf[2]’ may be used uninitialized in this function [-Werror=maybe-uninitialized] | ||
| 12 | usrdatum->bounds = le32_to_cpu(buf[2]); | ||
| 13 | ^ | ||
| 14 | cc1: all warnings being treated as errors | ||
| 15 | |||
| 16 | Which (as Andrew mentioned) is because GCC cannot assume | ||
| 17 | that 'p->policyvers' has the same value between checks. | ||
| 18 | |||
| 19 | We make it local, optimize the name to 'ver' and the warnings go away. | ||
| 20 | We also update another call site with this modification to | ||
| 21 | make it more inline with the rest of the functions. | ||
| 22 | |||
| 23 | Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com> | ||
| 24 | Acked-by: Daniel De Graaf <dgdegra@tycho.nsa.gov> | ||
| 25 | --- | ||
| 26 | xen/xsm/flask/ss/policydb.c | 17 ++++++++++------- | ||
| 27 | 1 file changed, 10 insertions(+), 7 deletions(-) | ||
| 28 | |||
| 29 | diff --git a/xen/xsm/flask/ss/policydb.c b/xen/xsm/flask/ss/policydb.c | ||
| 30 | index a1060b1..eebfe9c 100644 | ||
| 31 | --- a/xen/xsm/flask/ss/policydb.c | ||
| 32 | +++ b/xen/xsm/flask/ss/policydb.c | ||
| 33 | @@ -1258,6 +1258,7 @@ static int role_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 34 | int rc; | ||
| 35 | __le32 buf[3]; | ||
| 36 | u32 len; | ||
| 37 | + u32 ver = p->policyvers; | ||
| 38 | |||
| 39 | role = xzalloc(struct role_datum); | ||
| 40 | if ( !role ) | ||
| 41 | @@ -1266,7 +1267,7 @@ static int role_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 42 | goto out; | ||
| 43 | } | ||
| 44 | |||
| 45 | - if ( p->policyvers >= POLICYDB_VERSION_BOUNDARY ) | ||
| 46 | + if ( ver >= POLICYDB_VERSION_BOUNDARY ) | ||
| 47 | rc = next_entry(buf, fp, sizeof(buf[0]) * 3); | ||
| 48 | else | ||
| 49 | rc = next_entry(buf, fp, sizeof(buf[0]) * 2); | ||
| 50 | @@ -1276,7 +1277,7 @@ static int role_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 51 | |||
| 52 | len = le32_to_cpu(buf[0]); | ||
| 53 | role->value = le32_to_cpu(buf[1]); | ||
| 54 | - if ( p->policyvers >= POLICYDB_VERSION_BOUNDARY ) | ||
| 55 | + if ( ver >= POLICYDB_VERSION_BOUNDARY ) | ||
| 56 | role->bounds = le32_to_cpu(buf[2]); | ||
| 57 | |||
| 58 | key = xmalloc_array(char, len + 1); | ||
| 59 | @@ -1328,6 +1329,7 @@ static int type_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 60 | int rc; | ||
| 61 | __le32 buf[4]; | ||
| 62 | u32 len; | ||
| 63 | + u32 ver = p->policyvers; | ||
| 64 | |||
| 65 | typdatum = xzalloc(struct type_datum); | ||
| 66 | if ( !typdatum ) | ||
| 67 | @@ -1336,7 +1338,7 @@ static int type_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 68 | return rc; | ||
| 69 | } | ||
| 70 | |||
| 71 | - if ( p->policyvers >= POLICYDB_VERSION_BOUNDARY ) | ||
| 72 | + if ( ver >= POLICYDB_VERSION_BOUNDARY ) | ||
| 73 | rc = next_entry(buf, fp, sizeof(buf[0]) * 4); | ||
| 74 | else | ||
| 75 | rc = next_entry(buf, fp, sizeof(buf[0]) * 3); | ||
| 76 | @@ -1346,7 +1348,7 @@ static int type_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 77 | |||
| 78 | len = le32_to_cpu(buf[0]); | ||
| 79 | typdatum->value = le32_to_cpu(buf[1]); | ||
| 80 | - if ( p->policyvers >= POLICYDB_VERSION_BOUNDARY ) | ||
| 81 | + if ( ver >= POLICYDB_VERSION_BOUNDARY ) | ||
| 82 | { | ||
| 83 | u32 prop = le32_to_cpu(buf[2]); | ||
| 84 | |||
| 85 | @@ -1421,6 +1423,7 @@ static int user_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 86 | int rc; | ||
| 87 | __le32 buf[3]; | ||
| 88 | u32 len; | ||
| 89 | + u32 ver = p->policyvers; | ||
| 90 | |||
| 91 | usrdatum = xzalloc(struct user_datum); | ||
| 92 | if ( !usrdatum ) | ||
| 93 | @@ -1429,7 +1432,7 @@ static int user_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 94 | goto out; | ||
| 95 | } | ||
| 96 | |||
| 97 | - if ( p->policyvers >= POLICYDB_VERSION_BOUNDARY ) | ||
| 98 | + if ( ver >= POLICYDB_VERSION_BOUNDARY ) | ||
| 99 | rc = next_entry(buf, fp, sizeof(buf[0]) * 3); | ||
| 100 | else | ||
| 101 | rc = next_entry(buf, fp, sizeof(buf[0]) * 2); | ||
| 102 | @@ -1439,7 +1442,7 @@ static int user_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 103 | |||
| 104 | len = le32_to_cpu(buf[0]); | ||
| 105 | usrdatum->value = le32_to_cpu(buf[1]); | ||
| 106 | - if ( p->policyvers >= POLICYDB_VERSION_BOUNDARY ) | ||
| 107 | + if ( ver >= POLICYDB_VERSION_BOUNDARY ) | ||
| 108 | usrdatum->bounds = le32_to_cpu(buf[2]); | ||
| 109 | |||
| 110 | key = xmalloc_array(char, len + 1); | ||
| 111 | @@ -1457,7 +1460,7 @@ static int user_read(struct policydb *p, struct hashtab *h, void *fp) | ||
| 112 | if ( rc ) | ||
| 113 | goto bad; | ||
| 114 | |||
| 115 | - if ( p->policyvers >= POLICYDB_VERSION_MLS ) | ||
| 116 | + if ( ver >= POLICYDB_VERSION_MLS ) | ||
| 117 | { | ||
| 118 | rc = mls_read_range_helper(&usrdatum->range, fp); | ||
| 119 | if ( rc ) | ||
| 120 | -- | ||
| 121 | 2.1.0 | ||
| 122 | |||
diff --git a/recipes-extended/xen/xen_4.6.0.bb b/recipes-extended/xen/xen_4.6.0.bb index 41241cd4..7650e463 100644 --- a/recipes-extended/xen/xen_4.6.0.bb +++ b/recipes-extended/xen/xen_4.6.0.bb | |||
| @@ -2,6 +2,7 @@ require xen.inc | |||
| 2 | 2 | ||
| 3 | SRC_URI = " \ | 3 | SRC_URI = " \ |
| 4 | http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz \ | 4 | http://bits.xensource.com/oss-xen/release/${PV}/xen-${PV}.tar.gz \ |
| 5 | file://xen-xsm-Make-p-policyvers-be-a-local-variable-ver-to.patch \ | ||
| 5 | " | 6 | " |
| 6 | 7 | ||
| 7 | SRC_URI[md5sum] = "48e232f90927c08326a7b52bb06f49bc" | 8 | SRC_URI[md5sum] = "48e232f90927c08326a7b52bb06f49bc" |
