summaryrefslogtreecommitdiff
path: root/drivers/platform/x86
diff options
context:
space:
mode:
authorGaurav Singh <gaurav1086@gmail.com>2020-06-24 06:31:25 +0300
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2020-07-09 22:57:27 +0300
commitaff374dfe7330be10a20c97bd0b3196c153e9f9e (patch)
tree9d2c90ea96d2bd3e6cd6a89453d81eee1366a94d /drivers/platform/x86
parentcd85b55cfceff62a95a81eea99859df6336b7d1f (diff)
downloadlinux-aff374dfe7330be10a20c97bd0b3196c153e9f9e.tar.xz
platform/x86: intel_pmc_core: fix bound check in pmc_core_mphy_pg_show()
Check bounds before accessing map[] array. Signed-off-by: Gaurav Singh <gaurav1086@gmail.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Diffstat (limited to 'drivers/platform/x86')
-rw-r--r--drivers/platform/x86/intel_pmc_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 5a0a25e9ccc9..338ea5222555 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -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" :