From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754118AbcB2LFx (ORCPT ); Mon, 29 Feb 2016 06:05:53 -0500 Received: from torg.zytor.com ([198.137.202.12]:53368 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752028AbcB2LFt (ORCPT ); Mon, 29 Feb 2016 06:05:49 -0500 Date: Mon, 29 Feb 2016 03:04:48 -0800 From: tip-bot for Thomas Gleixner Message-ID: Cc: bp@alien8.de, andi.kleen@intel.com, jolsa@redhat.com, vincent.weaver@maine.edu, eranian@google.com, hpa@zytor.com, torvalds@linux-foundation.org, linux-kernel@vger.kernel.org, peterz@infradead.org, tglx@linutronix.de, acme@redhat.com, kan.liang@intel.com, jacob.jun.pan@linux.intel.com, mingo@kernel.org, harish.chegondi@intel.com Reply-To: linux-kernel@vger.kernel.org, eranian@google.com, hpa@zytor.com, torvalds@linux-foundation.org, vincent.weaver@maine.edu, bp@alien8.de, andi.kleen@intel.com, jolsa@redhat.com, jacob.jun.pan@linux.intel.com, mingo@kernel.org, harish.chegondi@intel.com, acme@redhat.com, kan.liang@intel.com, tglx@linutronix.de, peterz@infradead.org In-Reply-To: <20160222221010.929967806@linutronix.de> References: <20160222221010.929967806@linutronix.de> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf/x86/intel/uncore: Add sanity checks for PCI dev package id Git-Commit-ID: 83f8ebd2eb459b21e8e74d43c75e1be666ec8b97 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 83f8ebd2eb459b21e8e74d43c75e1be666ec8b97 Gitweb: http://git.kernel.org/tip/83f8ebd2eb459b21e8e74d43c75e1be666ec8b97 Author: Thomas Gleixner AuthorDate: Mon, 22 Feb 2016 22:19:10 +0000 Committer: Ingo Molnar CommitDate: Mon, 29 Feb 2016 09:35:14 +0100 perf/x86/intel/uncore: Add sanity checks for PCI dev package id The storage array is size limited, but misses a sanity check Signed-off-by: Thomas Gleixner Signed-off-by: Peter Zijlstra (Intel) Cc: Andi Kleen Cc: Arnaldo Carvalho de Melo Cc: Borislav Petkov Cc: Harish Chegondi Cc: Jacob Pan Cc: Jiri Olsa Cc: Kan Liang Cc: Linus Torvalds Cc: Peter Zijlstra Cc: Stephane Eranian Cc: Vince Weaver Cc: linux-kernel@vger.kernel.org Link: http://lkml.kernel.org/r/20160222221010.929967806@linutronix.de Signed-off-by: Ingo Molnar --- arch/x86/events/intel/uncore.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/events/intel/uncore.c b/arch/x86/events/intel/uncore.c index 25e6203..42ea435 100644 --- a/arch/x86/events/intel/uncore.c +++ b/arch/x86/events/intel/uncore.c @@ -882,7 +882,7 @@ static int uncore_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id 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) {