Received: by 10.223.176.46 with SMTP id f43csp1675985wra; Wed, 24 Jan 2018 21:29:46 -0800 (PST) X-Google-Smtp-Source: AH8x224QtxrPUnqFyVhsdQuhJl+vPef4CRS2Pr7M1+B0PCqYHXfI9uXhwTp7Ydfu8yj7HcWkHZBB X-Received: by 10.98.66.152 with SMTP id h24mr14954579pfd.13.1516858185965; Wed, 24 Jan 2018 21:29:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516858185; cv=none; d=google.com; s=arc-20160816; b=g/noEIV8Caa0hGJTTCMBWSKsFjuY8e/1wX3Yth/pmh7QC7fGhuLuLupk8m2tv/SnJM D5Ptt+0U6UHWWG9EU5XY77iXxtgGqzcTTBmmz4XumgZHCJMgPyTVDMoykXLt+NtGcS6s WHZWeNO0iwuwCJJw3H+sww8JvdE0JEF4b88E+FaG2MUY0GidZAHEys7L8Cs5wCwmq1ZU F37m4DEAeHwY2sz2Li+Asg9Ow4xbmTZUca3Mcu1H/BH62dnryCnWEZ0OtwlvAFuDP7/z a8RVt2c9/S9s28AbumfgJmYRTNZyBO7QKOSglhlEsCHlGe1Jn/9cQcn2CJKlV78RLCAo dZmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dmarc-filter:arc-authentication-results; bh=7u4pKWevD+VXB90Oyt+Oi0E5bYSP825Tlx9yIiA/qDU=; b=sAO7KhXCVsY1PK7bWlELwutOPN7tXeL3qOmxD3SgNij0eBg7rb3jBrtpu7yNW6UbS5 QvxJvPIBvEc4TOqAP/fT9csLE4uzTLrgxjWjbxHob3TcKvghlzs5heP9eGvsYmuqFJhV /lUvoTc47POMihW67cB/q8RwrpQ6svBx8MBA1mBIxU5xrNNf7zh3sgo6B3mpVjt3lOCd sPXD1dcEAj5oPpTJlZKJ5iQEkE4/EuV/T2oHCPYCo+Gfe8t4Yq9UonZJEMXdTGhYKVge MA4I4e67S0/9sPdCKh85LwwgyRJSW1S5nncERfzp2yqjOAmMpEeLJgsat6pt3BEzcvJx /Dfw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l4si1088730pgo.794.2018.01.24.21.29.32; Wed, 24 Jan 2018 21:29:45 -0800 (PST) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751237AbeAYF22 (ORCPT + 99 others); Thu, 25 Jan 2018 00:28:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:42110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750769AbeAYF21 (ORCPT ); Thu, 25 Jan 2018 00:28:27 -0500 Received: from localhost.localdomain (NE2965lan1.rev.em-net.ne.jp [210.141.244.193]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A44A021785; Thu, 25 Jan 2018 05:28:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A44A021785 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=mhiramat@kernel.org From: Masami Hiramatsu To: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Cc: Ingo Molnar , "H . Peter Anvin" , x86@kernel.org, Masami Hiramatsu , Ananth N Mavinakayanahalli , Anil S Keshavamurthy , "David S . Miller" , Jon Medhurst , Will Deacon , Arnd Bergmann , David Howells , Heiko Carstens , "Tobin C . Harding" , Linus Torvalds Subject: [PATCH 3/8] kprobes: Replace %p with other pointer types Date: Thu, 25 Jan 2018 14:28:02 +0900 Message-Id: <151685808262.3099.402832363414780425.stgit@devbox> X-Mailer: git-send-email 2.13.6 In-Reply-To: <151685799071.3099.10383062804474021403.stgit@devbox> References: <151685799071.3099.10383062804474021403.stgit@devbox> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace %p with appropriate pointer types (or just remove it) - Use %pS if possible - Use %px only for the function right before BUG(). - Remove unneeded error message. Signed-off-by: Masami Hiramatsu --- kernel/kprobes.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/kernel/kprobes.c b/kernel/kprobes.c index a5f13e379ae1..02887975d445 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -712,7 +712,7 @@ static void reuse_unused_kprobe(struct kprobe *ap) op = container_of(ap, struct optimized_kprobe, kp); if (unlikely(list_empty(&op->list))) printk(KERN_WARNING "Warning: found a stray unused " - "aggrprobe@%p\n", ap->addr); + "aggrprobe@%pS\n", ap->addr); /* Enable the probe again */ ap->flags &= ~KPROBE_FLAG_DISABLED; /* Optimize it again (remove from op->list) */ @@ -984,7 +984,7 @@ static void arm_kprobe_ftrace(struct kprobe *p) ret = ftrace_set_filter_ip(&kprobe_ftrace_ops, (unsigned long)p->addr, 0, 0); - WARN(ret < 0, "Failed to arm kprobe-ftrace at %p (%d)\n", p->addr, ret); + WARN(ret < 0, "Failed to arm kprobe-ftrace at %pS (%d)\n", p->addr, ret); kprobe_ftrace_enabled++; if (kprobe_ftrace_enabled == 1) { ret = register_ftrace_function(&kprobe_ftrace_ops); @@ -1004,7 +1004,7 @@ static void disarm_kprobe_ftrace(struct kprobe *p) } ret = ftrace_set_filter_ip(&kprobe_ftrace_ops, (unsigned long)p->addr, 1, 0); - WARN(ret < 0, "Failed to disarm kprobe-ftrace at %p (%d)\n", p->addr, ret); + WARN(ret < 0, "Failed to disarm kprobe-ftrace at %pS (%d)\n", p->addr, ret); } #else /* !CONFIG_KPROBES_ON_FTRACE */ #define prepare_kprobe(p) arch_prepare_kprobe(p) @@ -2124,10 +2124,11 @@ int enable_kprobe(struct kprobe *kp) } EXPORT_SYMBOL_GPL(enable_kprobe); +/* Caller must NOT call this in usual path. This is only for critical case */ void dump_kprobe(struct kprobe *kp) { - printk(KERN_WARNING "Dumping kprobe:\n"); - printk(KERN_WARNING "Name: %s\nAddress: %p\nOffset: %x\n", + pr_err("Dumping kprobe:\n"); + pr_err("Name: %s\nAddress: %px\nOffset: %x\n", kp->symbol_name, kp->addr, kp->offset); } NOKPROBE_SYMBOL(dump_kprobe); @@ -2151,11 +2152,8 @@ static int __init populate_kprobe_blacklist(unsigned long *start, entry = arch_deref_entry_point((void *)*iter); if (!kernel_text_address(entry) || - !kallsyms_lookup_size_offset(entry, &size, &offset)) { - pr_err("Failed to find blacklist at %p\n", - (void *)entry); + !kallsyms_lookup_size_offset(entry, &size, &offset)) continue; - } ent = kmalloc(sizeof(*ent), GFP_KERNEL); if (!ent)