pan/bi: Fix nondeterministic register packing
authorAlyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Wed, 8 Apr 2020 17:35:34 +0000 (13:35 -0400)
committerTomeu Vizoso <tomeu.vizoso@collabora.com>
Fri, 10 Apr 2020 14:53:48 +0000 (16:53 +0200)
Uninitialized read.

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

src/panfrost/bifrost/bi_pack.c

index 519bc71304107d481ef6bd482279a6b094c3de3b..ae2a6df30f2fc13b4f9233378d4a79ee96a1117e 100644 (file)
@@ -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]) {