From 1daaf83dcea1c381924c8586315c50f5d0b8cf05 Mon Sep 17 00:00:00 2001 From: Vinod G Date: Mon, 10 Jun 2019 15:36:52 -0700 Subject: [PATCH] gpu: nvgpu: Fix CERT ARR37-C errors in common.gr.ctx unit Cert_arr37_c_violation: Using arithmetic operator on address which points to non-array object. Assign all pointer operands to array's 0th index address. Jira NVGPU-3585 Change-Id: I59c213ed6d17d2bfb6f58c649a1ec151fba2c72b Signed-off-by: Vinod G Reviewed-on: https://git-master.nvidia.com/r/2133863 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: Nitin Kumbhar GVS: Gerrit_Virtual_Submit Reviewed-by: Deepak Nibade Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/gr/ctx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/nvgpu/common/gr/ctx.c b/drivers/gpu/nvgpu/common/gr/ctx.c index eff26195c..9ba39e049 100644 --- a/drivers/gpu/nvgpu/common/gr/ctx.c +++ b/drivers/gpu/nvgpu/common/gr/ctx.c @@ -321,8 +321,8 @@ static void nvgpu_gr_ctx_unmap_global_ctx_buffers(struct gk20a *g, struct nvgpu_gr_global_ctx_buffer_desc *global_ctx_buffer, struct vm_gk20a *vm) { - u64 *g_bfr_va = gr_ctx->global_ctx_buffer_va; - u32 *g_bfr_index = gr_ctx->global_ctx_buffer_index; + u64 *g_bfr_va = &gr_ctx->global_ctx_buffer_va[0]; + u32 *g_bfr_index = &gr_ctx->global_ctx_buffer_index[0]; u32 i; nvgpu_log_fn(g, " "); @@ -349,8 +349,8 @@ int nvgpu_gr_ctx_map_global_ctx_buffers(struct gk20a *g, nvgpu_log_fn(g, " "); - g_bfr_va = gr_ctx->global_ctx_buffer_va; - g_bfr_index = gr_ctx->global_ctx_buffer_index; + g_bfr_va = &gr_ctx->global_ctx_buffer_va[0]; + g_bfr_index = &gr_ctx->global_ctx_buffer_index[0]; /* Circular Buffer */ #ifdef NVGPU_VPR