From 365c7cc87cbbf86c3fd9d24871a2785f6dfb74ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marcin=20=C5=9Alusarz?= Date: Thu, 24 Jun 2021 11:30:03 +0200 Subject: [PATCH] intel/decoder: add assert for register size MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Jason Ekstrand Part-of: --- 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);