gpu: nvgpu: fix CERT-C errors in common.gr.falcon

Used nvgpu_safe_mult_u32 function for u32 multiplications to avoid
CERT INT 30-C errors.

JIRA NVGPU-3622

Change-Id: Id945910a586c00be0f0cdad941b17023db66b23b
Signed-off-by: Seshendra Gadagottu <sgadagottu@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/2134621
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Seshendra Gadagottu
2019-06-11 15:23:25 -07:00
committed by mobile promotions
parent 6110bcf586
commit b2ed105fe5

View File

@@ -318,12 +318,16 @@ int nvgpu_gr_falcon_init_ctxsw_ucode(struct gk20a *g,
ucode_size = 0;
nvgpu_gr_falcon_init_ctxsw_ucode_segments(&ucode_info->fecs,
&ucode_size, fecs_boot_desc,
nvgpu_netlist_get_fecs_inst_count(g) * (u32)sizeof(u32),
nvgpu_netlist_get_fecs_data_count(g) * (u32)sizeof(u32));
nvgpu_safe_mult_u32(
nvgpu_netlist_get_fecs_inst_count(g), (u32)sizeof(u32)),
nvgpu_safe_mult_u32(
nvgpu_netlist_get_fecs_data_count(g), (u32)sizeof(u32)));
nvgpu_gr_falcon_init_ctxsw_ucode_segments(&ucode_info->gpccs,
&ucode_size, gpccs_boot_desc,
nvgpu_netlist_get_gpccs_inst_count(g) * (u32)sizeof(u32),
nvgpu_netlist_get_gpccs_data_count(g) * (u32)sizeof(u32));
nvgpu_safe_mult_u32(
nvgpu_netlist_get_gpccs_inst_count(g), (u32)sizeof(u32)),
nvgpu_safe_mult_u32(
nvgpu_netlist_get_gpccs_data_count(g), (u32)sizeof(u32)));
err = nvgpu_dma_alloc_sys(g, ucode_size, &ucode_info->surface_desc);
if (err != 0) {