Mesa (master): pan/bi: Fix nondeterministic register packing

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Apr 10 15:11:42 UTC 2020


Module: Mesa
Branch: master
Commit: 90e02db9a13527cc5c64d83201614181cc95c131
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=90e02db9a13527cc5c64d83201614181cc95c131

Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date:   Wed Apr  8 13:35:34 2020 -0400

pan/bi: Fix nondeterministic register packing

Uninitialized read.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4505>

---

 src/panfrost/bifrost/bi_pack.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 519bc713041..ae2a6df30f2 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -353,7 +353,7 @@ static uint64_t
 bi_pack_registers(struct bi_registers regs)
 {
         enum bifrost_reg_control ctrl = bi_pack_register_ctrl(regs);
-        struct bifrost_regs s;
+        struct bifrost_regs s = { 0 };
         uint64_t packed = 0;
 
         if (regs.enabled[1]) {
@@ -375,6 +375,7 @@ bi_pack_registers(struct bi_registers regs)
                 s.reg0 = regs.port[0];
         } else {
                 /* Port 1 disabled, so set to zero and use port 1 for ctrl */
+                s.ctrl = 0;
                 s.reg1 = ctrl << 2;
 
                 if (regs.enabled[0]) {



More information about the mesa-commit mailing list