From patchwork Wed Apr 29 15:18:46 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: 47725 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wg0-f71.google.com (mail-wg0-f71.google.com [74.125.82.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 0FC042121F for ; Wed, 29 Apr 2015 15:18:39 +0000 (UTC) Received: by wghm4 with SMTP id m4sf7441902wgh.2 for ; Wed, 29 Apr 2015 08:18:38 -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=R2lAne5wQ8GbJEqHKpDFSLso/XZQB10WoJ1dnHLuxDE=; b=ZUpJwIhNU1hSwSitrNOfvN/tC+1CccVu8clYAQLceYGB7KLgl7kBQg4UsO7D8IznIz OuFV8OcJTpZ2yh9EQkIink37FkeffbcKBOFVXb20YI9vi9vSD/ssoQ6Ln54KJOukoKta lSTPsOxrCmPNc0uiuGD4MEBYkanfNldEu5x/CEiYyTERHLlt9ghjW4kc+krSYtik4nuQ +qMq9p66FJKvU0pLebKCcurgr2KSCBHWy9P5aWNYlncXFXxPVvxMx4bdPY3SU4jqsMZX wHDDgynECv8Cjzgj0pk4w6aZhyH2Xl35/yum2KyWM6AioE1popo+beRPVDCwf2chvvQR Q61A== X-Gm-Message-State: ALoCoQnKOusCN78v51ik4gLGIzZB4RaNjU7HWGXVh+lZJLYruRshP/sYan/P3/kr+1WTeKr+W6V5 X-Received: by 10.152.116.115 with SMTP id jv19mr13513055lab.9.1430320718362; Wed, 29 Apr 2015 08:18:38 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.245.43 with SMTP id xl11ls246929lac.21.gmail; Wed, 29 Apr 2015 08:18:38 -0700 (PDT) X-Received: by 10.152.25.227 with SMTP id f3mr19044299lag.67.1430320718099; Wed, 29 Apr 2015 08:18:38 -0700 (PDT) Received: from mail-la0-f42.google.com (mail-la0-f42.google.com. [209.85.215.42]) by mx.google.com with ESMTPS id vr2si19600259lbb.13.2015.04.29.08.18.38 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 29 Apr 2015 08:18:38 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.42 as permitted sender) client-ip=209.85.215.42; Received: by lagv1 with SMTP id v1so22625236lag.3 for ; Wed, 29 Apr 2015 08:18:38 -0700 (PDT) X-Received: by 10.112.29.36 with SMTP id g4mr19912484lbh.56.1430320718007; Wed, 29 Apr 2015 08:18:38 -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 l1csp2569309lbt; Wed, 29 Apr 2015 08:18:37 -0700 (PDT) X-Received: by 10.70.101.106 with SMTP id ff10mr43327663pdb.162.1430320716134; Wed, 29 Apr 2015 08:18:36 -0700 (PDT) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id lr7si26361582pab.66.2015.04.29.08.18.35; Wed, 29 Apr 2015 08:18:36 -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 S1423038AbbD2PSa (ORCPT + 27 others); Wed, 29 Apr 2015 11:18:30 -0400 Received: from static.88-198-71-155.clients.your-server.de ([88.198.71.155]:58862 "EHLO socrates.bennee.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031735AbbD2PS1 (ORCPT ); Wed, 29 Apr 2015 11:18:27 -0400 Received: from localhost ([127.0.0.1] helo=zen.linaroharston) by socrates.bennee.com with esmtp (Exim 4.80) (envelope-from ) id 1YnUxw-0000dz-Qv; Wed, 29 Apr 2015 18:36:05 +0200 From: =?UTF-8?q?Alex=20Benn=C3=A9e?= To: rostedt@goodmis.org, mingo@redhat.com, Dave.Martin@arm.com Cc: linux-kernel@vger.kernel.org, =?UTF-8?q?Alex=20Benn=C3=A9e?= , Oleg Nesterov , Javi Merino , "Peter Zijlstra (Intel)" Subject: [PATCH v2] tracing: make ftrace_print_array_seq compute buf_len Date: Wed, 29 Apr 2015 16:18:46 +0100 Message-Id: <1430320727-14582-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.215.42 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 (__print_array) was getting it wrong by passing the array length instead of buffer length. As the element size was already being passed for other reasons it seems reasonable to push the calculation of buffer length into the function. Signed-off-by: Alex Bennée --- v2: - more explicit commit message - rename len -> count to reduce ambiguity --- 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..33a66e6 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 count, size_t el_size); struct trace_iterator; diff --git a/kernel/trace/trace_output.c b/kernel/trace/trace_output.c index 692bf71..25a086b 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 count, size_t el_size) { const char *ret = trace_seq_buffer_ptr(p); const char *prefix = ""; void *ptr = (void *)buf; + size_t buf_len = count * el_size; trace_seq_putc(p, '{');