[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xen staging-4.20] flask: fix gcov build with gcc14+



commit 2bc123400820b8290320ccab017882aaa826f0cb
Author:     Jan Beulich <jbeulich@xxxxxxxx>
AuthorDate: Thu Jan 29 13:45:23 2026 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Jan 29 13:45:23 2026 +0100

    flask: fix gcov build with gcc14+
    
    Gcc's "threading" of conditionals can lead to undue warnings, as reported
    in e.g. https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116519 (no matter
    that the overall situation is different there). While my gcc15 complains
    ("buf[2] may be used uninitialized in this function") about only two of
    the three instances (not about the one in type_read()), adjust all three
    to be on the safe side.
    
    Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
    Acked-by: Daniel P. Smith <dpsmith@xxxxxxxxxxxxxxxxxxxx>
    master commit: 7db4509d80242cc03cc7228c50e88248c8eeb02f
    master date: 2026-01-26 10:34:14 +0100
---
 xen/xsm/flask/ss/policydb.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/xen/xsm/flask/ss/policydb.c b/xen/xsm/flask/ss/policydb.c
index 5af45fdc27..17e98ded50 100644
--- a/xen/xsm/flask/ss/policydb.c
+++ b/xen/xsm/flask/ss/policydb.c
@@ -1272,7 +1272,10 @@ static int cf_check role_read(struct policydb *p, struct 
hashtab *h, void *fp)
     if ( ver >= POLICYDB_VERSION_BOUNDARY )
         rc = next_entry(buf, fp, sizeof(buf[0]) * 3);
     else
+    {
         rc = next_entry(buf, fp, sizeof(buf[0]) * 2);
+        buf[2] = cpu_to_le32(0); /* gcc14 onwards */
+    }
 
     if ( rc < 0 )
         goto bad;
@@ -1343,7 +1346,10 @@ static int cf_check type_read(struct policydb *p, struct 
hashtab *h, void *fp)
     if ( ver >= POLICYDB_VERSION_BOUNDARY )
         rc = next_entry(buf, fp, sizeof(buf[0]) * 4);
     else
+    {
         rc = next_entry(buf, fp, sizeof(buf[0]) * 3);
+        buf[3] = cpu_to_le32(0); /* gcc14 onwards */
+    }
 
     if ( rc < 0 )
         goto bad;
@@ -1437,7 +1443,10 @@ static int cf_check user_read(struct policydb *p, struct 
hashtab *h, void *fp)
     if ( ver >= POLICYDB_VERSION_BOUNDARY )
         rc = next_entry(buf, fp, sizeof(buf[0]) * 3);
     else
+    {
         rc = next_entry(buf, fp, sizeof(buf[0]) * 2);
+        buf[2] = cpu_to_le32(0); /* gcc14 onwards */
+    }
 
     if ( rc < 0 )
         goto bad;
--
generated by git-patchbot for /home/xen/git/xen.git#staging-4.20



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.