Skip to contentSkip to conversation

perf/x86/uncore: fix missing end markers for SNB/IVB/HSW IMC PMU

PATCH In review Stephane Eranian 3 participants 4 messages Mar 13, 2014 – Mar 14, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 perf/x86/uncore: fix missing end markers for SNB/IVB/HSW IMC PMU

This patch fixes a bug with the SNB/IVB/HSW uncore mmeory controller support.

The PCI Ids tables for the memory controller were missing end markers. That could cause random crashes on boot during or after PCI device registration.

--

arch/x86/kernel/cpu/perf_event_intel_uncore.c +3 -0
index f509ab1..bd2253d 100644
@@ -1989,6 +1989,7 @@ static DEFINE_PCI_DEVICE_TABLE(snb_uncore_pci_ids) = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SNB_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* end: all zeroes */ },
 };
 
 static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = {
@@ -1996,6 +1997,7 @@ static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* end: all zeroes */ },
 };
 
 static DEFINE_PCI_DEVICE_TABLE(hsw_uncore_pci_ids) = {
@@ -2003,6 +2005,7 @@ static DEFINE_PCI_DEVICE_TABLE(hsw_uncore_pci_ids) = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HSW_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* end: all zeroes */ },
 };
 
 static struct pci_driver snb_uncore_pci_driver = {
#1 lore raw
Quoted 6 lines · Stephane Eranian

This patch fixes a bug with the SNB/IVB/HSW uncore mmeory controller support.

The PCI Ids tables for the memory controller were missing end markers. That could cause random crashes on boot during or after PCI device registration.

I wonder if there's a way to check this in checkpatch.pl ?

Or maybe a sparse check could be added, with a new type attribute that says "needs to be 0 terminate"

-Andi

Signature · 1 line
[email protected] -- Speaking for myself only
#2 lore raw
Quoted 5 lines · Andi Kleen
Quoted 3 lines · Stephane Eranian

This patch fixes a bug with the SNB/IVB/HSW uncore mmeory controller support.

Quoted 9 lines
Quoted 3 lines

The PCI Ids tables for the memory controller were missing end markers. That could cause random crashes on boot during or after PCI device registration.

I wonder if there's a way to check this in checkpatch.pl ?

Or maybe a sparse check could be added, with a new type attribute that says "needs to be 0 terminate"

Not that easy , because in some cases, the size may be passed as a parameter to the call or maybe embedded into a struct passed to the call. But if you target this specific macro, you should be able to find the issues.

Quoted 4 lines

-Andi

--
[email protected] -- Speaking for myself only

#3 lore raw

[tip:perf/core] perf/x86/uncore: Fix missing end markers for SNB/ IVB/HSW IMC PMU

In reply to Stephane Eranian
perf/x86/uncore: Fix missing end markers for SNB/IVB/HSW IMC PMU
Commit-ID:  81827ed8d85e892311965dc9ec4120b2b2e745bd
Gitweb:     http://git.kernel.org/tip/81827ed8d85e892311965dc9ec4120b2b2e745bd
Author:     Stephane Eranian <[email protected]>
AuthorDate: Thu, 13 Mar 2014 13:04:36 +0100
Committer:  Ingo Molnar <[email protected]>
CommitDate: Fri, 14 Mar 2014 09:25:25 +0100

perf/x86/uncore: Fix missing end markers for SNB/IVB/HSW IMC PMU

This patch fixes a bug with the SNB/IVB/HSW uncore mmeory controller support.

The PCI Ids tables for the memory controller were missing end markers. That could cause random crashes on boot during or after PCI device registration.

--

---
 arch/x86/kernel/cpu/perf_event_intel_uncore.c | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/cpu/perf_event_intel_uncore.c +3 -0
index dfd50ea..618d502 100644
@@ -1989,6 +1989,7 @@ static DEFINE_PCI_DEVICE_TABLE(snb_uncore_pci_ids) = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SNB_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* end: all zeroes */ },
 };
 
 static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = {
@@ -1996,6 +1997,7 @@ static DEFINE_PCI_DEVICE_TABLE(ivb_uncore_pci_ids) = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_IVB_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* end: all zeroes */ },
 };
 
 static DEFINE_PCI_DEVICE_TABLE(hsw_uncore_pci_ids) = {
@@ -2003,6 +2005,7 @@ static DEFINE_PCI_DEVICE_TABLE(hsw_uncore_pci_ids) = {
 		PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_HSW_IMC),
 		.driver_data = UNCORE_PCI_DEV_DATA(SNB_PCI_UNCORE_IMC, 0),
 	},
+	{ /* end: all zeroes */ },
 };
 
 static struct pci_driver snb_uncore_pci_driver = {