gpu: nvgpu: top: fix CERT-C violations

CERT-C Rule INT30-C Requires that unsigned integer operations do not
wrap. Fix these violations by using the safe ops.

JIRA NVGPU-3868

Change-Id: I3e06f048e87497a4558fcdaf730fe503c817e629
Signed-off-by: Philip Elcan <pelcan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2170237
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
Reviewed-by: svc-mobile-misra <svc-mobile-misra@nvidia.com>
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Deepak Nibade <dnibade@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Philip Elcan
2019-08-06 11:19:11 -04:00
committed by mobile promotions
parent 6434bc4975
commit 97e67bf785

View File

@@ -83,7 +83,8 @@ u32 gp10b_get_num_engine_type_entries(struct gk20a *g, u32 engine_type)
top_device_info_type_enum_v(table_entry));
if (top_device_info_type_enum_v(table_entry) ==
engine_type) {
num_entries++;
num_entries = nvgpu_safe_add_u32(num_entries,
1U);
}
}
}