All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kyle Tso <kyletso@google.com>
To: gregkh@linuxfoundation.org, rafael@kernel.org
Cc: badhri@google.com, linux-kernel@vger.kernel.org,
	Kyle Tso <kyletso@google.com>
Subject: [PATCH] sysfs: Replace %p with %pK in the warning of sysfs_emit*
Date: Fri, 23 Jun 2023 22:20:54 +0800	[thread overview]
Message-ID: <20230623142054.3945121-1-kyletso@google.com> (raw)

According to Documentation/core-api/printk-formats.rst, kernel pointers
need to be printed with %pK format specifier to respect kptr_restrict in
sysctl.

Also replace the function names in the strings with %s and __func__ as
checkpatch.pl suggested.

Signed-off-by: Kyle Tso <kyletso@google.com>
---
 fs/sysfs/file.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/sysfs/file.c b/fs/sysfs/file.c
index a12ac0356c69..56712f0886ef 100644
--- a/fs/sysfs/file.c
+++ b/fs/sysfs/file.c
@@ -732,7 +732,7 @@ int sysfs_emit(char *buf, const char *fmt, ...)
 	int len;
 
 	if (WARN(!buf || offset_in_page(buf),
-		 "invalid sysfs_emit: buf:%p\n", buf))
+		 "invalid %s: buf:%pK\n", __func__, buf))
 		return 0;
 
 	va_start(args, fmt);
@@ -760,7 +760,7 @@ int sysfs_emit_at(char *buf, int at, const char *fmt, ...)
 	int len;
 
 	if (WARN(!buf || offset_in_page(buf) || at < 0 || at >= PAGE_SIZE,
-		 "invalid sysfs_emit_at: buf:%p at:%d\n", buf, at))
+		 "invalid %s: buf:%pK at:%d\n", __func__, buf, at))
 		return 0;
 
 	va_start(args, fmt);
-- 
2.41.0.162.gfafddb0af9-goog


             reply	other threads:[~2023-06-23 14:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-23 14:20 Kyle Tso [this message]
2023-06-23 14:30 ` [PATCH] sysfs: Replace %p with %pK in the warning of sysfs_emit* Greg KH
2023-06-23 14:51   ` Kyle Tso

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=20230623142054.3945121-1-kyletso@google.com \
    --to=kyletso@google.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@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.