mirror of
git://nv-tegra.nvidia.com/linux-nvgpu.git
synced 2025-12-24 10:34:43 +03:00
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
This commit is contained in:
committed by
mobile promotions
parent
7fd02cf343
commit
0db4570b5f
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms and conditions of the GNU General Public License,
|
||||
@@ -182,13 +182,16 @@ static u32 devinit_get_clk_prog_table(struct gk20a *g,
|
||||
|
||||
gk20a_dbg_info("");
|
||||
|
||||
if (g->ops.bios.get_perf_table_ptrs) {
|
||||
clkprogs_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.clock_token, CLOCK_PROGRAMMING_TABLE);
|
||||
if (clkprogs_tbl_ptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (!g->ops.bios.get_perf_table_ptrs) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
clkprogs_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.clock_token, CLOCK_PROGRAMMING_TABLE);
|
||||
if (clkprogs_tbl_ptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&header, clkprogs_tbl_ptr, hszfmt);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved.
|
||||
* Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* 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,
|
||||
|
||||
gk20a_dbg_info("");
|
||||
|
||||
if (g->ops.bios.get_perf_table_ptrs) {
|
||||
vfevars_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.perf_token,
|
||||
CONTINUOUS_VIRTUAL_BINNING_TABLE);
|
||||
if (vfevars_tbl_ptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (!g->ops.bios.get_perf_table_ptrs) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
vfevars_tbl_ptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.perf_token,
|
||||
CONTINUOUS_VIRTUAL_BINNING_TABLE);
|
||||
if (vfevars_tbl_ptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&vfevars_tbl_header, vfevars_tbl_ptr,
|
||||
|
||||
Reference in New Issue
Block a user