Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp379132rwd; Mon, 12 Jun 2023 15:16:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ67ooPvEeZuE7hqM1MY8uRNvBc6Mw7ksfOGVvtXLpDZfSSyQAN1Pr+F3PUA5f5Ftybb4M4J X-Received: by 2002:a05:6a20:8405:b0:10d:f812:e4b5 with SMTP id c5-20020a056a20840500b0010df812e4b5mr11560634pzd.35.1686608197410; Mon, 12 Jun 2023 15:16:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686608197; cv=none; d=google.com; s=arc-20160816; b=wsLFEkNKceWIymYnp3oDF/xo+O9IK42pkRmdSN4nCjjFUlOJHJR8T4Nfr++CvuzmDC V2yV2T7aZheiGiNcV/l87EkHI2RN2hnJPuNQoW0KcpxHPsA6W6YjmEexnleObcAfSxjf MKKv3Sx1/8DzRZZrY1VTWCB+iEVYtQWxatgpiDf0d+s0L8IeoaKYfYTCJ3Qei/hApsP8 8a1DXsiuRIDlArM4apQVxcrmZah0ZPNCRByMejH5GUyRIcGBtcVUm9zbH4E426V8+6C4 BsdBjeCDPXtw9of1pPPMfA9D3WErNbpL9u4y/B//SJJK/afJp+iZXbiS1I2NuTdanrpt qBoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=InFrTlz85dhUoJ9iyzM0RjKcmxjjE0VoysF4YLPizzQ=; b=fa4w4VgZatW/PMM98BBC0tuKZrV5+4VjguOJzxbS4ZOCB03GXfiyvcTVpJq6GBkNMR KtWz3XOaAFqhE3+q0kC5LpW9BG4q9bV1l7BQLV1kXtz1ga45iCnETHkYGI5cz/zFn0uh YWvIiL2ttp3t/vSnwDPQHDF1CjmG6i+/l6DSVgURdT4o+KEowzj39jfyzArnIag7gX1S HceZE+xwByEzp0JT6HyCEi6p5t4L1rntc+f7fH9AaNKPvNb3U9CyY2sNs98v+QJj/Q9s 7KXFlqfDvkUz7K+O6xzSoteD/ReciSm7k+NZNkQ44QTXtyfSyag4+62dDfzPevxZpAMJ zNig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EjOn7ojz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t23-20020a63b257000000b005429626e279si7121260pgo.87.2023.06.12.15.16.24; Mon, 12 Jun 2023 15:16:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=EjOn7ojz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238332AbjFLWDe (ORCPT + 99 others); Mon, 12 Jun 2023 18:03:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233166AbjFLWDd (ORCPT ); Mon, 12 Jun 2023 18:03:33 -0400 Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB328E7E for ; Mon, 12 Jun 2023 15:03:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1686607410; x=1718143410; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=HOyuQFngdneJCdfSjNA/K4eevMiAXCxbNP4WWdAC2rE=; b=EjOn7ojzcAtek7F37ANKMHrSZSVySkuVg8dUznFGsn0DFKRec/M/mVch oR5v7mN/1ysFttduWvBLkeC0Vp1dfEZy1EuR1bJURABcTbUvRuP63x+R5 k2E+32mURJtfBFvR11mxrCQBmM9fNHhNqL2iisu4Jr2alyNRvkTufdWVF XUh/+ReMZDE+KTsK2eyCinCyUkoWLlcT0LI8tDx6nvye8IXu4kBksiJzw Id16tb/A/zOPDCbR4lDzrlkeXhj/xSNkF+1KS06jvvsmwHBOoDVywlnci Lv4GdwJMPHH3SYGBgWfSdEoGAn4UIxXtbKUyigUIMQgA2EVpHHYyHL5j8 A==; X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="444550188" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="444550188" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jun 2023 15:03:30 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10739"; a="958183347" X-IronPort-AV: E=Sophos;i="6.00,236,1681196400"; d="scan'208";a="958183347" Received: from black.fi.intel.com ([10.237.72.28]) by fmsmga006.fm.intel.com with ESMTP; 12 Jun 2023 15:03:29 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id C4861357; Tue, 13 Jun 2023 01:03:37 +0300 (EEST) From: Andy Shevchenko To: linux-kernel@vger.kernel.org Cc: Dave Hansen , Andy Shevchenko Subject: [PATCH v1 1/1] signal: Use %*ph for printing hexdump of a small buffer Date: Tue, 13 Jun 2023 01:03:34 +0300 Message-Id: <20230612220334.44177-1-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The kernel already has a helper to print a hexdump of a small buffer via pointer extension. Use that instead of open coded variant. In long term it helps to kill pr_cont() or at least narrow down its use. Signed-off-by: Andy Shevchenko --- kernel/signal.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/kernel/signal.c b/kernel/signal.c index b5370fe5c198..6be2df76f0b4 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -1259,18 +1259,17 @@ static void print_fatal_signal(int signr) pr_info("potentially unexpected fatal signal %d.\n", signr); #if defined(__i386__) && !defined(__arch_um__) - pr_info("code at %08lx: ", regs->ip); { + unsigned char insn[16]; int i; + for (i = 0; i < 16; i++) { - unsigned char insn; - - if (get_user(insn, (unsigned char *)(regs->ip + i))) + if (get_user(insn[i], (unsigned char __user *)(regs->ip + i))) break; - pr_cont("%02x ", insn); } + + pr_info("code at %08lx: %*ph\n", regs->ip, i, insn); } - pr_cont("\n"); #endif preempt_disable(); show_regs(regs); -- 2.40.0.1.gaa8946217a0b