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 VBIOS supports it
We retrieve perf table from VBIOS only if respective HAL op is implemented. Later in code we unconditionally dereference the pointer which can lead to NULL pointer access. Fix by early aborting creation of devinit tables if the perf VBIOS getter is missing. Change-Id: If48aa6dac724056dd1feb2ef520e343736d4db85 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: http://git-master/r/1279223 GVS: Gerrit_Virtual_Submit Reviewed-by: Thomas Fleury <tfleury@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
2a95a288b2
commit
f37f4e27e3
@@ -182,20 +182,21 @@ u32 dev_init_get_vfield_info(struct gk20a *g,
|
||||
u8 *psegmentcount = NULL;
|
||||
u32 status = 0;
|
||||
|
||||
if (g->ops.bios.get_perf_table_ptrs) {
|
||||
vfieldregtableptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.virt_token, VP_FIELD_REGISTER);
|
||||
if (vfieldregtableptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
if (!g->ops.bios.get_perf_table_ptrs)
|
||||
return -EINVAL;
|
||||
|
||||
vfieldtableptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.virt_token, VP_FIELD_TABLE);
|
||||
if (vfieldtableptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
vfieldregtableptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.virt_token, VP_FIELD_REGISTER);
|
||||
if (vfieldregtableptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
vfieldtableptr = (u8 *)g->ops.bios.get_perf_table_ptrs(g,
|
||||
g->bios.virt_token, VP_FIELD_TABLE);
|
||||
if (vfieldtableptr == NULL) {
|
||||
status = -EINVAL;
|
||||
goto done;
|
||||
}
|
||||
|
||||
memcpy(&vregheader, vfieldregtableptr, VFIELD_REG_HEADER_SIZE);
|
||||
|
||||
Reference in New Issue
Block a user