From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: linux-kernel@vger.kernel.org
Cc: Dave Hansen <dave.hansen@linux.intel.com>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Subject: [PATCH v1 1/1] signal: Use %*ph for printing hexdump of a small buffer
Date: Tue, 13 Jun 2023 01:03:34 +0300 [thread overview]
Message-ID: <20230612220334.44177-1-andriy.shevchenko@linux.intel.com> (raw)
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 <andriy.shevchenko@linux.intel.com>
---
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
next reply other threads:[~2023-06-12 22:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-12 22:03 Andy Shevchenko [this message]
2023-06-13 13:19 ` [PATCH v1 1/1] signal: Use %*ph for printing hexdump of a small buffer David Laight
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230612220334.44177-1-andriy.shevchenko@linux.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dave.hansen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.