From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756197AbcBVW2j (ORCPT ); Mon, 22 Feb 2016 17:28:39 -0500 Received: from www.linutronix.de ([62.245.132.108]:36752 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755735AbcBVWU1 (ORCPT ); Mon, 22 Feb 2016 17:20:27 -0500 Message-Id: <20160222221010.929967806@linutronix.de> User-Agent: quilt/0.63-1 Date: Mon, 22 Feb 2016 22:19:10 -0000 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , x86@kernel.org, Borislav Petkov , Stephane Eranian , Harish Chegondi , Kan Liang , Andi Kleen , Jacob Pan Subject: [patch V3 04/28] x86/perf/intel/uncore: Add sanity checks for pci dev package id References: <20160222220733.632098221@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=x86-perf-intel_uncore--Add-sanity-checks-for-package-id.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The storage array is size limited, but misses a sanity check Signed-off-by: Thomas Gleixner --- arch/x86/kernel/cpu/perf_event_intel_uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Index: b/arch/x86/kernel/cpu/perf_event_intel_uncore.c =================================================================== --- a/arch/x86/kernel/cpu/perf_event_intel_uncore.c +++ b/arch/x86/kernel/cpu/perf_event_intel_uncore.c @@ -882,7 +882,7 @@ static int uncore_pci_probe(struct pci_d int phys_id, ret; phys_id = uncore_pcibus_to_physid(pdev->bus); - if (phys_id < 0) + if (phys_id < 0 || phys_id >= UNCORE_SOCKET_MAX) return -ENODEV; if (UNCORE_PCI_DEV_TYPE(id->driver_data) == UNCORE_EXTRA_PCI_DEV) {