Skip to content

Commit

Permalink
platform/x86: intel_pmc_core: fix bound check in pmc_core_mphy_pg_show()
Browse files Browse the repository at this point in the history
Check bounds before accessing map[] array.

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Gaurav Singh authored and Andy Shevchenko committed Jul 9, 2020
1 parent cd85b55 commit aff374d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/platform/x86/intel_pmc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,7 +795,7 @@ static int pmc_core_mphy_pg_show(struct seq_file *s, void *unused)
msleep(10);
val_high = pmc_core_reg_read(pmcdev, SPT_PMC_MFPMC_OFFSET);

for (index = 0; map[index].name && index < 8; index++) {
for (index = 0; index < 8 && map[index].name; index++) {
seq_printf(s, "%-32s\tState: %s\n",
map[index].name,
map[index].bit_mask & val_low ? "Not power gated" :
Expand Down

0 comments on commit aff374d

Please sign in to comment.