Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2619053ybb; Mon, 30 Mar 2020 09:35:23 -0700 (PDT) X-Google-Smtp-Source: ADFU+vuZxm1MtLwGetiZ17vb0WEXq6BfSFiFuyP77cHtbXOAHZX2rId/vDI1BokYff4qM2wLo0Yl X-Received: by 2002:a9d:4698:: with SMTP id z24mr9575194ote.271.1585586122781; Mon, 30 Mar 2020 09:35:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585586122; cv=none; d=google.com; s=arc-20160816; b=uGbj9aEzk+5NzugvWbW+giog5C2cV0ZtZowCqwgXuGRwVYiEmSgMEV/EBME5UrbSfF x8FRZmi85HQcODGGeJO0B4mCuvHJLp/xzCiTO0zDks48uZZciTBIwpCMlFuN/WHInWxi EEpHQDuuWqZRvHhRNfoRKeNayiUzX0d57YgpcEorjuXgr60TCminWruTQhukn4RoaOiG vjcGRuNfx2ATN5TEbcbJRAFsZeA390TaV9sL0X+w7Bogq0oma7Thl60TcPjvFX/V5DLU lLA2D88B17sDXDk4WDzPT1ZI17WzVGtklzTb0Dzkwo3fgLgX4QUvwBsqr9Xm6Jt1ag+d xLhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=JSKzIe6iDeO9mCZKo/3slq31feX1Q7KMMBdiVxw/p1g=; b=gaKP3Bd0lY/uiZECnEafSBPyZOt46eoALHCrE5f3wKjMAjFsmLWUpadFGgvzZ/L+ZD cUKPthC3/I1K2iFqviNbishTF7bqk8XkDs690i9H9smuQwb75P5xTeSfkR850AT73tml uCe/S7yqzEOU/FDnL1+dXDFADDspgiOx2WpUrznw8iUQFgz7eEUGOd4qA0P4Rhy2sQm0 lvQtL4qCdnboSBjTpa4U02AisCvHfGKtXTSwLGvK58j0amOesrPtXY7jyFhXfHRUSMvI ng1Peo7y/jYJVIz/LsQufnKsfx2nnrea2+byw+fSjtm5QhO6CDRoSdGs5LbcruL8t1u5 tOVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Zwhge/VJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 192si5837786oii.36.2020.03.30.09.35.03; Mon, 30 Mar 2020 09:35:22 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b="Zwhge/VJ"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728941AbgC3Pn1 (ORCPT + 99 others); Mon, 30 Mar 2020 11:43:27 -0400 Received: from us-smtp-delivery-74.mimecast.com ([216.205.24.74]:46670 "EHLO us-smtp-delivery-74.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728207AbgC3Pn1 (ORCPT ); Mon, 30 Mar 2020 11:43:27 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1585583006; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type; bh=JSKzIe6iDeO9mCZKo/3slq31feX1Q7KMMBdiVxw/p1g=; b=Zwhge/VJ3UtmwMpOtGeg8S5997owI66VyOgm4PySfNKKz2Yg8TOB6391sh08jYsrnUeIlh fcmAxI8Mx6HpDLi05lrDgxPQXzMLMPaJxq1KMJtg1NKBfKK0qy/NL3G7C/kvMchVyB6cBM xCphehDmH4o5mUvY5yXeHgU9GamtDRU= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-197-ebfQAMnqOb2o8GavhFwh3Q-1; Mon, 30 Mar 2020 11:43:21 -0400 X-MC-Unique: ebfQAMnqOb2o8GavhFwh3Q-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 42F2D800D50; Mon, 30 Mar 2020 15:43:20 +0000 (UTC) Received: from quaco.ghostprotocols.net (unknown [10.3.128.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9BDFA96F88; Mon, 30 Mar 2020 15:43:19 +0000 (UTC) Received: by quaco.ghostprotocols.net (Postfix, from userid 1000) id DBFC2409A3; Mon, 30 Mar 2020 12:43:14 -0300 (-03) Date: Mon, 30 Mar 2020 12:43:14 -0300 From: Arnaldo Carvalho de Melo To: Jiri Olsa Cc: Adrian Hunter , Jin Yao , Namhyung Kim , Linux Kernel Mailing List Subject: [PATCH 1/1] perf report/top TUI: Fix title line formatting Message-ID: <20200330154314.GB4576@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Acks? :) --- In d10ec006dcd7 ("perf hists browser: Allow passing an initial hotkey") the hist_entry__title() call was cut'n'pasted to a function where the 'title' variable is a pointer, not an array, so the sizeof(title) continues syntactically valid but ends up reducing the real size of the buffer where to format the first line in the screen to 8 bytes, which makes the formatting at the title at each refresh to produce just the string "Samples ", duh, fix it by passing the size of the buffer. Cc: Adrian Hunter Cc: Jin Yao Cc: Jiri Olsa Cc: Namhyung Kim Fixes: d10ec006dcd7 ("perf hists browser: Allow passing an initial hotkey") Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/ui/browsers/hists.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c index 95ac5e2ea949..487e54ef56a9 100644 --- a/tools/perf/ui/browsers/hists.c +++ b/tools/perf/ui/browsers/hists.c @@ -677,7 +677,7 @@ static int hist_browser__title(struct hist_browser *browser, char *bf, size_t si return browser->title ? browser->title(browser, bf, size) : 0; } -static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lost_event, char *title, int key) +static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_lost_event, char *title, size_t size, int key) { switch (key) { case K_TIMER: { @@ -703,7 +703,7 @@ static int hist_browser__handle_hotkey(struct hist_browser *browser, bool warn_l ui_browser__warn_lost_events(&browser->b); } - hist_browser__title(browser, title, sizeof(title)); + hist_browser__title(browser, title, size); ui_browser__show_title(&browser->b, title); break; } @@ -764,13 +764,13 @@ int hist_browser__run(struct hist_browser *browser, const char *help, if (ui_browser__show(&browser->b, title, "%s", help) < 0) return -1; - if (key && hist_browser__handle_hotkey(browser, warn_lost_event, title, key)) + if (key && hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) goto out; while (1) { key = ui_browser__run(&browser->b, delay_secs); - if (hist_browser__handle_hotkey(browser, warn_lost_event, title, key)) + if (hist_browser__handle_hotkey(browser, warn_lost_event, title, sizeof(title), key)) break; } out: -- 2.25.1