mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
gpu: nvgpu: utils: fix CERT-C violations
Rule INT31-C requires that integer conversions do not result in lost or misinterpreted data. Rule INT32-C requires that operations on signed integers do not result in overflow. Rule EXP34-C requires that pointer dereferences never include NULL. Fix violations of these types in nvgpu.common.utils. JIRA NVGPU-3868 Change-Id: Ifcf4bc6536ca2df2adcb53b40b3e58316cc3e457 Signed-off-by: Philip Elcan <pelcan@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/2168576 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Reviewed-by: Nitin Kumbhar <nkumbhar@nvidia.com> Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
390695e67e
commit
09f7dd7fdd
@@ -23,6 +23,7 @@
|
||||
#include <nvgpu/enabled.h>
|
||||
#include <nvgpu/bitops.h>
|
||||
#include <nvgpu/gk20a.h>
|
||||
#include <nvgpu/safe_ops.h>
|
||||
|
||||
int nvgpu_init_enabled_flags(struct gk20a *g)
|
||||
{
|
||||
@@ -48,16 +49,16 @@ void nvgpu_free_enabled_flags(struct gk20a *g)
|
||||
nvgpu_kfree(g, g->enabled_flags);
|
||||
}
|
||||
|
||||
bool nvgpu_is_enabled(struct gk20a *g, int flag)
|
||||
bool nvgpu_is_enabled(struct gk20a *g, u32 flag)
|
||||
{
|
||||
return nvgpu_test_bit((u32)flag, g->enabled_flags);
|
||||
return nvgpu_test_bit(flag, g->enabled_flags);
|
||||
}
|
||||
|
||||
void nvgpu_set_enabled(struct gk20a *g, int flag, bool state)
|
||||
void nvgpu_set_enabled(struct gk20a *g, u32 flag, bool state)
|
||||
{
|
||||
if (state) {
|
||||
nvgpu_set_bit((u32)flag, g->enabled_flags);
|
||||
nvgpu_set_bit(flag, g->enabled_flags);
|
||||
} else {
|
||||
nvgpu_clear_bit((u32)flag, g->enabled_flags);
|
||||
nvgpu_clear_bit(flag, g->enabled_flags);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user