summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/perf
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-01-04 15:41:18 -0500
committermobile promotions <svcmobile_promotions@nvidia.com>2017-01-06 12:13:59 -0500
commit0db4570b5fc014b472bedb5c1490a5ce5d2f3f99 (patch)
tree2071b0001e23fb95cf4797592055a3030ed0ebbf /drivers/gpu/nvgpu/perf
parent7fd02cf343b8ba527865b64512fd684eb4bab313 (diff)
gpu: nvgpu: Use perf table only if VBIOS supports it
We retrieve perf table from VBIOS only if respective HAL op is implemented. Later in code we unconditionally dereference a pointer which can lead to NULL pointer access. Fix two new cases by early aborting creation of devinit tables if the perf VBIOS getter is missing. Bug 200192125 Change-Id: I30f20f1829305ecc1117c6301e26ff1b869967eb Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1280347 GVS: Gerrit_Virtual_Submit
Diffstat (limited to 'drivers/gpu/nvgpu/perf')
-rw-r--r--drivers/gpu/nvgpu/perf/vfe_var.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/gpu/nvgpu/perf/vfe_var.c b/drivers/gpu/nvgpu/perf/vfe_var.c
index f43e68e2..65ede64a 100644
--- a/drivers/gpu/nvgpu/perf/vfe_var.c
+++ b/drivers/gpu/nvgpu/perf/vfe_var.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. 2 * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify it 4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License, 5 * under the terms and conditions of the GNU General Public License,
@@ -868,14 +868,17 @@ static u32 devinit_get_vfe_var_table(struct gk20a *g,
868 868
869 gk20a_dbg_info(""); 869 gk20a_dbg_info("");
870 870
871 if (g->ops.bios.get_perf_table_ptrs) { 871 if (!g->ops.bios.get_perf_table_ptrs) {
872 vfevars_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g, 872 status = -EINVAL;
873 g->bios.perf_token, 873 goto done;
874 CONTINUOUS_VIRTUAL_BINNING_TABLE); 874 }
875 if (vfevars_tbl_ptr == NULL) { 875
876 status = -EINVAL; 876 vfevars_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
877 goto done; 877 g->bios.perf_token,
878 } 878 CONTINUOUS_VIRTUAL_BINNING_TABLE);
879 if (vfevars_tbl_ptr == NULL) {
880 status = -EINVAL;
881 goto done;
879 } 882 }
880 883
881 memcpy(&vfevars_tbl_header, vfevars_tbl_ptr, 884 memcpy(&vfevars_tbl_header, vfevars_tbl_ptr,