Mesa (main): intel/decoder: add assert for register size

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jun 28 09:43:53 UTC 2021


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

Author: Marcin Ślusarz <marcin.slusarz at intel.com>
Date:   Thu Jun 24 11:30:03 2021 +0200

intel/decoder: add assert for register size

Coverity complains about out-of-bounds access in
intel_field_iterator_init, because it doesn't know that the GT_MODE
register has a size of 4 bytes. Add an assertion to verify that.

CID: 1474552

Signed-off-by: Marcin Ślusarz <marcin.slusarz at intel.com>
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11574>

---

 src/intel/common/intel_batch_decoder.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/intel/common/intel_batch_decoder.c b/src/intel/common/intel_batch_decoder.c
index ed5b3242215..f7abd28397a 100644
--- a/src/intel/common/intel_batch_decoder.c
+++ b/src/intel/common/intel_batch_decoder.c
@@ -927,6 +927,8 @@ handle_gt_mode(struct intel_batch_decode_ctx *ctx,
 {
    struct intel_group *reg = intel_spec_find_register(ctx->spec, reg_addr);
 
+   assert(intel_group_get_length(reg, &val) == 1);
+
    struct intel_field_iterator iter;
    intel_field_iterator_init(&iter, reg, &val, 0, false);
 



More information about the mesa-commit mailing list