summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2016-11-08 16:13:43 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2016-11-11 11:20:34 -0500
commitf6ab3c7cfeb22120d786f588b0dc380a238d13d3 (patch)
treee7c7249b4ca73051f2078a9eacc259ce3aa8c6cd /drivers
parentd09d259d74d229bb22e3440ab0660ecd66f94250 (diff)
gpu: nvgpu: Prevent integer overflow of GPU config
In CDE GPU CONFIGURATION the result is computed using 32-bit arithmetic and returned as 64-bit unsigned integer. Cast intermediate result to u64 to prevent unintentional overflow. Change-Id: Iebe53e2b17c1aaa498245a52962c3dbad7ce893e Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1249962 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Alex Waterman <alexw@nvidia.com> Reviewed-by: Seema Khowala <seemaj@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/nvgpu/gk20a/cde_gk20a.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
index 17453489..8b3d0dfa 100644
--- a/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/cde_gk20a.c
@@ -374,7 +374,7 @@ static int gk20a_cde_patch_params(struct gk20a_cde_ctx *cde_ctx)
374 new_data = g->gr.comptags_per_cacheline; 374 new_data = g->gr.comptags_per_cacheline;
375 break; 375 break;
376 case TYPE_PARAM_GPU_CONFIGURATION: 376 case TYPE_PARAM_GPU_CONFIGURATION:
377 new_data = g->ltc_count * g->gr.slices_per_ltc * 377 new_data = (u64)g->ltc_count * g->gr.slices_per_ltc *
378 g->gr.cacheline_size; 378 g->gr.cacheline_size;
379 break; 379 break;
380 case TYPE_PARAM_FIRSTPAGEOFFSET: 380 case TYPE_PARAM_FIRSTPAGEOFFSET: