Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933774Ab3HHCZM (ORCPT ); Wed, 7 Aug 2013 22:25:12 -0400 Received: from mail-ve0-f171.google.com ([209.85.128.171]:55895 "EHLO mail-ve0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933558Ab3HHCZK (ORCPT ); Wed, 7 Aug 2013 22:25:10 -0400 Date: Wed, 7 Aug 2013 22:31:28 -0400 (EDT) From: Vince Weaver To: Stephen Boyd cc: Will Deacon , Vince Weaver , "linux-kernel@vger.kernel.org" , Mark Rutland , Peter Zijlstra , Ingo Molnar , Paul Mackerras , Arnaldo Carvalho de Melo , "trinity@vger.kernel.org" Subject: Re: perf,arm -- another (different) fuzzer oops In-Reply-To: <5202D5B0.9020107@codeaurora.org> Message-ID: References: <20130807223129.GA17118@mudshark.cambridge.arm.com> <5202D5B0.9020107@codeaurora.org> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1074 Lines: 35 On Wed, 7 Aug 2013, Stephen Boyd wrote: > ---8<---- > > diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c > index d9f5cd4..21f7790 100644 > --- a/arch/arm/kernel/perf_event.c > +++ b/arch/arm/kernel/perf_event.c > @@ -53,7 +53,12 @@ armpmu_map_cache_event(const unsigned (*cache_map) > static int > armpmu_map_hw_event(const unsigned (*event_map)[PERF_COUNT_HW_MAX], u64 config) > { > - int mapping = (*event_map)[config]; > + int mapping; > + > + if (config >= PERF_COUNT_HW_MAX) > + return -ENOENT; > + > + mapping = (*event_map)[config]; > return mapping == HW_OP_UNSUPPORTED ? -ENOENT : mapping; > } I've tested this patch and my testcase no longer causes the kernel to oops, so Tested-by: Vince Weaver Thanks, Vince -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/