From 3ad11341c129ea6b4192d11d39510f0c21946e75 Mon Sep 17 00:00:00 2001 From: Nitin Kumbhar Date: Wed, 11 Sep 2019 14:33:42 +0530 Subject: [PATCH] gpu: nvgpu: fix CERT-C EXP40-C issue in posix utils Remove const from __mptr declaration to fix EXP40-C violation. cert_exp40_c_violation: Casting pointer "__mptr" with type "struct nvgpu_clk_dev const *" to type "char *" allows an object defined with a const-qualified type to be modified through use of an lvalue with non-const-qualified type Considering implementation of container_of() a const is not required. JIRA NVGPU-3908 JIRA NVGPU-3561 Change-Id: Ie94c3f994a962124afcda49a178a72c9b87ba7c7 Signed-off-by: Nitin Kumbhar Reviewed-on: https://git-master.nvidia.com/r/2195032 GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/include/nvgpu/posix/utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h b/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h index 6b424a30f..7c3988b2e 100644 --- a/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h +++ b/drivers/gpu/nvgpu/include/nvgpu/posix/utils.h @@ -256,7 +256,7 @@ static inline unsigned int nvgpu_posix_hweight64(uint64_t x) }) #define container_of(ptr, type, member) ({ \ - const typeof(((type *)0)->member) *__mptr = (ptr); \ + typeof(((type *)0)->member) *__mptr = (ptr); \ (type *)((char *)__mptr - offsetof(type, member)); }) #define MAX_ERRNO 4095