mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-22 09:12:24 +03:00
gpu: nvgpu fix coverity issue in therm/cg unit
Add NULL check for ELCG and BLCG HALs based on cgmode to avoid coverity issue: CWE-476: NULL Pointer Dereference Bug 3952896 Change-Id: I3ee717645bbecaafddb5d485f57550e213bf762b Signed-off-by: Divya <dsinghatwari@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2864656 Reviewed-by: svcacv <svcacv@nvidia.com> Reviewed-by: Sagar Kamble <skamble@nvidia.com> Reviewed-by: Mahantesh Kumbar <mkumbar@nvidia.com> Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> Reviewed-by: svc-mobile-cert <svc-mobile-cert@nvidia.com> GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
@@ -33,8 +33,13 @@ static void nvgpu_cg_set_mode(struct gk20a *g, u32 cgmode, u32 mode_config)
|
||||
const struct nvgpu_device *dev = NULL;
|
||||
struct nvgpu_fifo *f = &g->fifo;
|
||||
|
||||
if ((g->ops.therm.init_blcg_mode == NULL) &&
|
||||
(g->ops.therm.init_elcg_mode == NULL)) {
|
||||
/*
|
||||
* Add NULL check for ELCG and BLCG HALs based on cgmode
|
||||
* to avoid coverity issue: CWE-476: NULL Pointer Dereference
|
||||
*/
|
||||
if ((cgmode == BLCG_MODE && g->ops.therm.init_blcg_mode == NULL) ||
|
||||
(cgmode == ELCG_MODE &&
|
||||
g->ops.therm.init_elcg_mode == NULL)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user