Mesa (main): anv: don't leave anv_batch fields undefined

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jan 7 17:50:43 UTC 2022


Module: Mesa
Branch: main
Commit: 1d40d53e03d33e0595016a95d645bd489ee95365
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1d40d53e03d33e0595016a95d645bd489ee95365

Author: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Date:   Thu Jan  6 15:58:17 2022 +0200

anv: don't leave anv_batch fields undefined

Because the extend_cb vfunc is not initialized, there is a risk that
the emission code calls into a random pointer.

Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin at intel.com>
Cc: mesa-stable
Reviewed-by: Rohan Garg <rohan.garg at intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14418>

---

 src/intel/vulkan/genX_state.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/intel/vulkan/genX_state.c b/src/intel/vulkan/genX_state.c
index 7177b9c136c..e2ec6ffc823 100644
--- a/src/intel/vulkan/genX_state.c
+++ b/src/intel/vulkan/genX_state.c
@@ -159,11 +159,12 @@ static VkResult
 init_render_queue_state(struct anv_queue *queue)
 {
    struct anv_device *device = queue->device;
-   struct anv_batch batch;
-
    uint32_t cmds[64];
-   batch.start = batch.next = cmds;
-   batch.end = (void *) cmds + sizeof(cmds);
+   struct anv_batch batch = {
+      .start = cmds,
+      .next = cmds,
+      .end = (void *) cmds + sizeof(cmds),
+   };
 
    anv_batch_emit(&batch, GENX(PIPELINE_SELECT), ps) {
 #if GFX_VER >= 9



More information about the mesa-commit mailing list