From a681c505c96dba58231ac050e4c8f4f81d79540f Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Tue, 24 Oct 2017 14:57:02 -0700 Subject: 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 Reviewed-on: https://git-master.nvidia.com/r/1586505 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svc-mobile-coverity GVS: Gerrit_Virtual_Submit Reviewed-by: Richard Zhao Reviewed-by: Terje Bergstrom Reviewed-by: mobile promotions Tested-by: mobile promotions --- drivers/gpu/nvgpu/pstate/pstate.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/gpu/nvgpu/pstate') diff --git a/drivers/gpu/nvgpu/pstate/pstate.c b/drivers/gpu/nvgpu/pstate/pstate.c index 512653ba..937756d3 100644 --- a/drivers/gpu/nvgpu/pstate/pstate.c +++ b/drivers/gpu/nvgpu/pstate/pstate.c @@ -307,7 +307,7 @@ static int parse_pstate_entry_5x(struct gk20a *g, static int parse_pstate_table_5x(struct gk20a *g, struct vbios_pstate_header_5x *hdr) { - struct pstate _pstate, *pstate = &_pstate; + struct pstate _pstate, *pstate; struct vbios_pstate_entry_5x *entry; u32 entry_size; u8 i; @@ -333,11 +333,11 @@ static int parse_pstate_table_5x(struct gk20a *g, if (entry->pstate_level == VBIOS_PERFLEVEL_SKIP_ENTRY) continue; - err = parse_pstate_entry_5x(g, hdr, entry, pstate); + err = parse_pstate_entry_5x(g, hdr, entry, &_pstate); if (err) goto done; - pstate = pstate_construct(g, pstate); + pstate = pstate_construct(g, &_pstate); if (!pstate) goto done; -- cgit v1.2.2