From patchwork Mon Apr 27 12:17:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 47611 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f72.google.com (mail-wg0-f72.google.com [74.125.82.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6D7E62121F for ; Mon, 27 Apr 2015 12:17:34 +0000 (UTC) Received: by wgiv13 with SMTP id v13sf24965201wgi.3 for ; Mon, 27 Apr 2015 05:17:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:content-type:content-transfer-encoding:sender :precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=dz9oFU8PMbF2ymW1sPVODBCC4aLd6PuWxGEzoobqNOc=; b=eXG4ZV77NSld5r7M7+hBzf/89A79HGfQtZqERG5pwBfGq8ePODSteVdZkeT2h1wSI0 mnBDEjERwCbVAu2vkwfRByNGnWccn3iv1hyoexZ1AOV0y7qfroeTvrTISW5Ed5a31KHq gc6D950bWLpYNeunnWxtPDFJhowOIi0inoXH2R1gsWFHg8tnsgntRoskU286LtpVVVJ1 MBO9Ixg/WuAE0rKvNIpSPsf6jlmGNY+PiEygZDXdg/Zur/YqHJEwfEcN+5xrikXlqIBB S2q/h7/RnlLfo62mBrCokdYS0BO4ZwJApgq7H2Jrh5+QFq3bP0LIeMflgQO3YsV7AtR9 SIxw== X-Gm-Message-State: ALoCoQkYbNHsTrp1DQbyDWzwpmtpoYhGi00rzPjuIVbx3VaJ1bJWp2gNOgrdfRRVKDFag/Rv8i29 X-Received: by 10.194.121.67 with SMTP id li3mr7184764wjb.3.1430137053635; Mon, 27 Apr 2015 05:17:33 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.8.114 with SMTP id q18ls765865laa.8.gmail; Mon, 27 Apr 2015 05:17:33 -0700 (PDT) X-Received: by 10.112.234.163 with SMTP id uf3mr10041909lbc.9.1430137053350; Mon, 27 Apr 2015 05:17:33 -0700 (PDT) Received: from mail-lb0-f169.google.com (mail-lb0-f169.google.com. [209.85.217.169]) by mx.google.com with ESMTPS id kk6si14654313lbc.72.2015.04.27.05.17.32 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 27 Apr 2015 05:17:32 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) client-ip=209.85.217.169; Received: by lbbqq2 with SMTP id qq2so80425303lbb.3 for ; Mon, 27 Apr 2015 05:17:32 -0700 (PDT) X-Received: by 10.112.204.72 with SMTP id kw8mr9915341lbc.88.1430137052780; Mon, 27 Apr 2015 05:17:32 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.67.65 with SMTP id l1csp1240251lbt; Mon, 27 Apr 2015 05:17:32 -0700 (PDT) X-Received: by 10.66.234.233 with SMTP id uh9mr21186444pac.81.1430137051056; Mon, 27 Apr 2015 05:17:31 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id im3si29608682pbb.55.2015.04.27.05.17.30; Mon, 27 Apr 2015 05:17:31 -0700 (PDT) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932805AbbD0MR0 (ORCPT + 27 others); Mon, 27 Apr 2015 08:17:26 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:44118 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932526AbbD0MRY (ORCPT ); Mon, 27 Apr 2015 08:17:24 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YmjB7-0005r7-3V; Mon, 27 Apr 2015 15:34:29 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: rostedt@goodmis.org, mingo@redhat.com Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Oleg Nesterov , "Peter Zijlstra (Intel)" , Dave Martin , Petr Mladek Subject: [PATCH] tracing: make ftrace_print_array_seq compute buf_len Date: Mon, 27 Apr 2015 13:17:48 +0100 Message-Id: <1430137069-859-1-git-send-email-alex.bennee@linaro.org> X-Mailer: git-send-email 2.3.5 MIME-Version: 1.0 X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: alex.bennee@linaro.org X-SA-Exim-Scanned: No (on socrates.bennee.com); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: alex.bennee@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.169 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The only caller to this function was getting it wrong. I favoured pushing the calculation to as close to the need as possible rather than fixing the one caller. Signed-off-by: Alex Bennée --- include/linux/ftrace_event.h | 2 +- kernel/trace/trace_output.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/ftrace_event.h b/include/linux/ftrace_event.h index c674ee8..e6b0262 100644 --- a/include/linux/ftrace_event.h +++ b/include/linux/ftrace_event.h @@ -45,7 +45,7 @@ const char *ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int len); const char *ftrace_print_array_seq(struct trace_seq *p, - const void *buf, int buf_len, + const void *buf, int len, size_t el_size); struct trace_iterator; diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 692bf71..a42703d 100644 --- a/kernel/trace/trace_output.c +++ b/kernel/trace/trace_output.c @@ -178,12 +178,13 @@ ftrace_print_hex_seq(struct trace_seq *p, const unsigned char *buf, int buf_len) EXPORT_SYMBOL(ftrace_print_hex_seq); const char * -ftrace_print_array_seq(struct trace_seq *p, const void *buf, int buf_len, +ftrace_print_array_seq(struct trace_seq *p, const void *buf, int len, size_t el_size) { const char *ret = trace_seq_buffer_ptr(p); const char *prefix = ""; void *ptr = (void *)buf; + size_t buf_len = len * el_size; trace_seq_putc(p, '{');