From e262bdb946539f1d3e4ff3a86e9008ff92634f01 Mon Sep 17 00:00:00 2001 From: Scott Long Date: Tue, 28 Jan 2020 17:51:52 -0800 Subject: [PATCH] gpu: nvgpu: whitelist MISRA 8.7 violations Whitelist false positives caused by a Coverity scanner bug where Advisory Rule 8.7 violations are raised when both 'static' and 'const' are used in the definition of an object. This bug exists in Coverity v2019.06 and is reported to be fixed in Coverity v2019.12. See nvbug 2823817 for more information. JIRA NVGPU-3178 Change-Id: I495e927766617f797f009cdd71a919b73ce371e8 Signed-off-by: Scott Long Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2286769 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Alex Waterman Reviewed-by: mobile promotions GVS: Gerrit_Virtual_Submit Tested-by: mobile promotions --- drivers/gpu/nvgpu/common/mm/allocators/bitmap_allocator.c | 2 ++ drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c | 2 ++ drivers/gpu/nvgpu/common/mm/nvgpu_mem.c | 2 ++ drivers/gpu/nvgpu/hal/init/hal_gv11b.c | 2 ++ 4 files changed, 8 insertions(+) diff --git a/drivers/gpu/nvgpu/common/mm/allocators/bitmap_allocator.c b/drivers/gpu/nvgpu/common/mm/allocators/bitmap_allocator.c index 79c362247..a333bcf68 100644 --- a/drivers/gpu/nvgpu/common/mm/allocators/bitmap_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/allocators/bitmap_allocator.c @@ -381,7 +381,9 @@ static void nvgpu_bitmap_print_stats(struct nvgpu_allocator *na, } #endif +NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 8_7), "Bug 2823817") static const struct nvgpu_allocator_ops bitmap_ops = { +NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 8_7)) .alloc = nvgpu_bitmap_balloc, .free_alloc = nvgpu_bitmap_free, diff --git a/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c b/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c index 89f3a1851..25d2a6782 100644 --- a/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c +++ b/drivers/gpu/nvgpu/common/mm/allocators/buddy_allocator.c @@ -1326,7 +1326,9 @@ static void nvgpu_buddy_print_stats(struct nvgpu_allocator *na, } #endif +NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 8_7), "Bug 2823817") static const struct nvgpu_allocator_ops buddy_ops = { +NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 8_7)) .alloc = nvgpu_buddy_balloc, .alloc_pte = nvgpu_buddy_balloc_pte, .free_alloc = nvgpu_buddy_bfree, diff --git a/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c b/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c index ece53ad89..a3e3d6d27 100644 --- a/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c +++ b/drivers/gpu/nvgpu/common/mm/nvgpu_mem.c @@ -364,7 +364,9 @@ static void nvgpu_mem_phys_sgt_free(struct gk20a *g, struct nvgpu_sgt *sgt) */ } +NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 8_7), "Bug 2823817") static const struct nvgpu_sgt_ops nvgpu_mem_phys_ops = { +NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 8_7)) .sgl_next = nvgpu_mem_phys_sgl_next, .sgl_dma = nvgpu_mem_phys_sgl_dma, .sgl_phys = nvgpu_mem_phys_sgl_phys, diff --git a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c index 83bd7f760..e7cd75887 100644 --- a/drivers/gpu/nvgpu/hal/init/hal_gv11b.c +++ b/drivers/gpu/nvgpu/hal/init/hal_gv11b.c @@ -225,7 +225,9 @@ static int gv11b_init_gpu_characteristics(struct gk20a *g) return 0; } +NVGPU_COV_WHITELIST_BLOCK_BEGIN(false_positive, 1, NVGPU_MISRA(Rule, 8_7), "Bug 2823817") static const struct gpu_ops gv11b_ops = { +NVGPU_COV_WHITELIST_BLOCK_END(NVGPU_MISRA(Rule, 8_7)) .acr = { .acr_init = nvgpu_acr_init, .acr_construct_execute = nvgpu_acr_construct_execute,