nvgpu: Fix CERT-C defects

Fix following CERT-C defects

- CID 631480
- CID 494546

Bug 3745813

Change-Id: I33ad7d044cc18219a117811b960dae26cf744983
Signed-off-by: srajum <srajum@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nvgpu/+/2834699
Reviewed-by: Sagar Kamble <skamble@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>
Reviewed-by: Ankur Kishore <ankkishore@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
srajum
2022-12-29 11:38:09 +05:30
committed by mobile promotions
parent db637cd585
commit 6d7ace12dc
2 changed files with 5 additions and 3 deletions

View File

@@ -1,7 +1,7 @@
/*
* Tegra GK20A GPU Debugger Driver Register Ops
*
* Copyright (c) 2013-2022, NVIDIA CORPORATION. All rights reserved.
* Copyright (c) 2013-2023, NVIDIA CORPORATION. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -568,7 +568,9 @@ static int profiler_obj_validate_reg_op_offset(struct nvgpu_profiler_object *pro
}
}
#endif
if (prof->reg_op_type[entry.type] > nvgpu_safe_cast_s32_to_u32(UCHAR_MAX)) {
goto error;
}
op->type = (u8)prof->reg_op_type[entry.type];
return 0;

View File

@@ -618,7 +618,7 @@ void gk20a_scale_exit(struct device *dev)
struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 10, 0)
struct devfreq *devfreq = l->devfreq;
struct gk20a_scale_profile *profile;
struct gk20a_scale_profile *profile = NULL;
#endif
int err;