From nobody Thu Apr 9 10:41:23 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 946AFC433FE for ; Mon, 10 Oct 2022 11:16:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231433AbiJJLQS (ORCPT ); Mon, 10 Oct 2022 07:16:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232056AbiJJLQO (ORCPT ); Mon, 10 Oct 2022 07:16:14 -0400 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2EBB24F66B for ; Mon, 10 Oct 2022 04:16:12 -0700 (PDT) Received: from dggpeml500023.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4MmGVN6x5wzpVxn; Mon, 10 Oct 2022 19:13:00 +0800 (CST) Received: from dggpeml100012.china.huawei.com (7.185.36.121) by dggpeml500023.china.huawei.com (7.185.36.114) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 10 Oct 2022 19:16:09 +0800 Received: from localhost.localdomain (10.67.175.61) by dggpeml100012.china.huawei.com (7.185.36.121) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Mon, 10 Oct 2022 19:16:09 +0800 From: Zheng Yejian To: , , CC: Subject: [PATCH] ftrace: Fix char print issue in print_ip_ins() Date: Mon, 10 Oct 2022 19:15:24 +0000 Message-ID: <20221010191524.1626867-1-zhengyejian1@huawei.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Originating-IP: [10.67.175.61] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggpeml100012.china.huawei.com (7.185.36.121) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" When ftrace bug happened, following log shows every byte data in problem ip address: actual: ffffffe8:6b:ffffffd9:01:21 However that seems a little confusing, and it is because format '%x' being used to print signed chars in print_ip_ins(). After this patch, the log is like: actual: e8:6b:d9:01:21 Fixes: 6c14133d2d3f ("ftrace: Do not blindly read the ip address in ftrace_= bug()") Signed-off-by: Zheng Yejian --- kernel/trace/ftrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 439e2ab6905e..251ba30c871d 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -2015,7 +2015,7 @@ static int ftrace_hash_ipmodify_update(struct ftrace_= ops *ops, =20 static void print_ip_ins(const char *fmt, const unsigned char *p) { - char ins[MCOUNT_INSN_SIZE]; + unsigned char ins[MCOUNT_INSN_SIZE]; int i; =20 if (copy_from_kernel_nofault(ins, p, MCOUNT_INSN_SIZE)) { --=20 2.25.1