gpu: nvgpu: fix corruption in pstate parsing

After first iteration parse_pstate_table_5x was reusing previously
parsed pstate as a temporary object, leading to corruption. Use
local _pstate variable instead.

JIRA EVLR-1959
Bug 200352099

Change-Id: Ia32382d5f7dace045064a39ea3db10119f86e9eb
Signed-off-by: Thomas Fleury <tfleury@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1586505
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: svc-mobile-coverity <svc-mobile-coverity@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Richard Zhao <rizhao@nvidia.com>
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
This commit is contained in:
Thomas Fleury
2017-10-24 14:57:02 -07:00
committed by mobile promotions
parent b18fa6c4a7
commit a681c505c9

View File

@@ -307,7 +307,7 @@ static int parse_pstate_entry_5x(struct gk20a *g,
static int parse_pstate_table_5x(struct gk20a *g, static int parse_pstate_table_5x(struct gk20a *g,
struct vbios_pstate_header_5x *hdr) struct vbios_pstate_header_5x *hdr)
{ {
struct pstate _pstate, *pstate = &_pstate; struct pstate _pstate, *pstate;
struct vbios_pstate_entry_5x *entry; struct vbios_pstate_entry_5x *entry;
u32 entry_size; u32 entry_size;
u8 i; u8 i;
@@ -333,11 +333,11 @@ static int parse_pstate_table_5x(struct gk20a *g,
if (entry->pstate_level == VBIOS_PERFLEVEL_SKIP_ENTRY) if (entry->pstate_level == VBIOS_PERFLEVEL_SKIP_ENTRY)
continue; continue;
err = parse_pstate_entry_5x(g, hdr, entry, pstate); err = parse_pstate_entry_5x(g, hdr, entry, &_pstate);
if (err) if (err)
goto done; goto done;
pstate = pstate_construct(g, pstate); pstate = pstate_construct(g, &_pstate);
if (!pstate) if (!pstate)
goto done; goto done;