summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2017-09-11 09:13:38 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-12 14:05:55 -0400
commit41283a02ac6837f01e1e67fca859ffd552c3ede0 (patch)
tree2a8ed0e27c082299a5c4eb3d828d8428905ced7a /drivers/gpu/nvgpu/gk20a
parente68391690cfcc23b77c68aec3f9605badea226ed (diff)
gpu: nvgpu: fix UBSAN warning of signed integer overflow
Fix below warning reported by UBSAN by explicitly type casting both the operators in multiplication as unsigned long [ 69.470802] UBSAN: Undefined behaviour in drivers/gpu/../../../nvgpu/drivers/gpu/nvgpu/gk20a/gk20a_scale.c:60:49 [ 69.485519] signed integer overflow: [ 69.489104] 2147483647 * 1000 cannot be represented in type 'int' [ 69.504424] Hardware name: quill (DT) [ 69.508088] Call trace: [ 69.510579] [<ffffff900809a600>] dump_backtrace+0x0/0x4f0 [ 69.515987] [<ffffff900809ab18>] show_stack+0x28/0x38 [ 69.521050] [<ffffff9008f0d8d8>] dump_stack+0x154/0x1c4 [ 69.526291] [<ffffff9008fd1ee0>] ubsan_epilogue+0x18/0xb0 [ 69.531720] [<ffffff9008fd321c>] handle_overflow+0x1c0/0x21c [ 69.537416] [<ffffff9008fd3334>] __ubsan_handle_mul_overflow+0x34/0x50 [ 69.544410] [<ffffff9003c73368>] gk20a_scale_qos_notify+0x210/0x2f0 [nvgpu] [ 69.551415] [<ffffff9008170884>] __blocking_notifier_call_chain+0xec/0x240 [ 69.558299] [<ffffff9008170a18>] blocking_notifier_call_chain+0x40/0x50 [ 69.564928] [<ffffff900825dd18>] pm_qos_update_bounded_target+0x738/0x1038 [ 69.571812] [<ffffff900825f4a0>] pm_qos_update_bounded_req+0x148/0x280 [ 69.578348] [<ffffff9008263224>] pm_qos_bounded_write+0x484/0x990 Bug 200342586 Change-Id: I35ee59a95b2e3625fb42f256d2877558be9e51cf Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1557156 Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com> Reviewed-by: svccoveritychecker <svccoveritychecker@nvidia.com> GVS: Gerrit_Virtual_Submit Reviewed-by: Pritesh Raithatha <praithatha@nvidia.com> Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a_scale.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
index 3e6fead6..4ee4f8ab 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a_scale.c
@@ -55,9 +55,9 @@ int gk20a_scale_qos_notify(struct notifier_block *nb,
55 mutex_lock(&devfreq->lock); 55 mutex_lock(&devfreq->lock);
56 /* check for pm_qos min and max frequency requirement */ 56 /* check for pm_qos min and max frequency requirement */
57 profile->qos_min_freq = 57 profile->qos_min_freq =
58 pm_qos_read_min_bound(PM_QOS_GPU_FREQ_BOUNDS) * 1000; 58 (unsigned long)pm_qos_read_min_bound(PM_QOS_GPU_FREQ_BOUNDS) * 1000UL;
59 profile->qos_max_freq = 59 profile->qos_max_freq =
60 pm_qos_read_max_bound(PM_QOS_GPU_FREQ_BOUNDS) * 1000; 60 (unsigned long)pm_qos_read_max_bound(PM_QOS_GPU_FREQ_BOUNDS) * 1000UL;
61 61
62 if (profile->qos_min_freq > profile->qos_max_freq) { 62 if (profile->qos_min_freq > profile->qos_max_freq) {
63 nvgpu_err(g, 63 nvgpu_err(g,