From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755010AbbG0Wmm (ORCPT ); Mon, 27 Jul 2015 18:42:42 -0400 Received: from mail-pd0-f169.google.com ([209.85.192.169]:34991 "EHLO mail-pd0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754956AbbG0WmW (ORCPT ); Mon, 27 Jul 2015 18:42:22 -0400 From: Mathieu Poirier To: a.p.zijlstra@chello.nl, mingo@redhat.com, acme@kernel.org, alexander.shishkin@linux.intel.com Cc: linux-kernel@vger.kernel.org, mathieu.poirier@linaro.org Subject: [PATCH] perf: fixing variable initialisation Date: Mon, 27 Jul 2015 16:41:19 -0600 Message-Id: <1438036879-16340-1-git-send-email-mathieu.poirier@linaro.org> X-Mailer: git-send-email 1.9.1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Variable 'max_order' needs to be initialised to log2 of the number of pages invariant of the no scather-gather PMU option. Otherwise 'rb_alloc_aux_page' gets an order that is equal to '0', which prevents the private page information to be set properly. Signed-off-by: Mathieu Poirier --- kernel/events/ring_buffer.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/kernel/events/ring_buffer.c b/kernel/events/ring_buffer.c index 96472824a752..bd3da7bebe9e 100644 --- a/kernel/events/ring_buffer.c +++ b/kernel/events/ring_buffer.c @@ -449,18 +449,18 @@ int rb_alloc_aux(struct ring_buffer *rb, struct perf_event *event, { bool overwrite = !(flags & RING_BUFFER_WRITABLE); int node = (event->cpu == -1) ? -1 : cpu_to_node(event->cpu); - int ret = -ENOMEM, max_order = 0; + int ret = -ENOMEM, max_order; if (!has_aux(event)) return -ENOTSUPP; - if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) { - /* - * We need to start with the max_order that fits in nr_pages, - * not the other way around, hence ilog2() and not get_order. - */ - max_order = ilog2(nr_pages); + /* + * We need to start with the max_order that fits in nr_pages, + * not the other way around, hence ilog2() and not get_order. + */ + max_order = ilog2(nr_pages); + if (event->pmu->capabilities & PERF_PMU_CAP_AUX_NO_SG) { /* * PMU requests more than one contiguous chunks of memory * for SW double buffering -- 1.9.1