mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] [drivers/x86] fix bound check in pmc_core_mphy_pg_show
@ 2020-06-24  3:31 Gaurav Singh
  2020-07-10 20:35 ` Andy Shevchenko
  0 siblings, 1 reply; 2+ messages in thread
From: Gaurav Singh @ 2020-06-24  3:31 UTC (permalink / raw)
  To: gaurav1086, Rajneesh Bhardwaj, Vishwanath Somayaji, Darren Hart,
	Andy Shevchenko, open list:INTEL PMC CORE DRIVER, open list

Check bounds before accessing map[].

Signed-off-by: Gaurav Singh <gaurav1086@gmail.com>
---
 drivers/platform/x86/intel_pmc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index 7c8bdab078cf..f571f9cf7217 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" :
-- 
2.17.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-07-10 20:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-24  3:31 [PATCH] [drivers/x86] fix bound check in pmc_core_mphy_pg_show Gaurav Singh
2020-07-10 20:35 ` Andy Shevchenko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®