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>
This commit is contained in:
Gaurav Singh 2020-06-23 23:31:25 -04:00 коммит произвёл Andy Shevchenko
Родитель cd85b55cfc
Коммит aff374dfe7
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -795,7 +795,7 @@ static int pmc_core_mphy_pg_show(struct seq_file *s, void *unused)
msleep(10); msleep(10);
val_high = pmc_core_reg_read(pmcdev, SPT_PMC_MFPMC_OFFSET); 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", seq_printf(s, "%-32s\tState: %s\n",
map[index].name, map[index].name,
map[index].bit_mask & val_low ? "Not power gated" : map[index].bit_mask & val_low ? "Not power gated" :