summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/pstate
diff options
context:
space:
mode:
authorThomas Fleury <tfleury@nvidia.com>2017-10-24 17:57:02 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-10-29 14:01:59 -0400
commita681c505c96dba58231ac050e4c8f4f81d79540f (patch)
treec97afeea13b12f7083e6b527bdbf7e7e5bcab1b6 /drivers/gpu/nvgpu/pstate
parentb18fa6c4a7867a9c0256ca2619ffa8ee04797820 (diff)
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>
Diffstat (limited to 'drivers/gpu/nvgpu/pstate')
-rw-r--r--drivers/gpu/nvgpu/pstate/pstate.c6
1 files changed, 3 insertions, 3 deletions
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,
307static int parse_pstate_table_5x(struct gk20a *g, 307static int parse_pstate_table_5x(struct gk20a *g,
308 struct vbios_pstate_header_5x *hdr) 308 struct vbios_pstate_header_5x *hdr)
309{ 309{
310 struct pstate _pstate, *pstate = &_pstate; 310 struct pstate _pstate, *pstate;
311 struct vbios_pstate_entry_5x *entry; 311 struct vbios_pstate_entry_5x *entry;
312 u32 entry_size; 312 u32 entry_size;
313 u8 i; 313 u8 i;
@@ -333,11 +333,11 @@ static int parse_pstate_table_5x(struct gk20a *g,
333 if (entry->pstate_level == VBIOS_PERFLEVEL_SKIP_ENTRY) 333 if (entry->pstate_level == VBIOS_PERFLEVEL_SKIP_ENTRY)
334 continue; 334 continue;
335 335
336 err = parse_pstate_entry_5x(g, hdr, entry, pstate); 336 err = parse_pstate_entry_5x(g, hdr, entry, &_pstate);
337 if (err) 337 if (err)
338 goto done; 338 goto done;
339 339
340 pstate = pstate_construct(g, pstate); 340 pstate = pstate_construct(g, &_pstate);
341 if (!pstate) 341 if (!pstate)
342 goto done; 342 goto done;
343 343