lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230623142054.3945121-1-kyletso@google.com>
Date:   Fri, 23 Jun 2023 22:20:54 +0800
From:   Kyle Tso <kyletso@...gle.com>
To:     gregkh@...uxfoundation.org, rafael@...nel.org
Cc:     badhri@...gle.com, linux-kernel@...r.kernel.org,
        Kyle Tso <kyletso@...gle.com>
Subject: [PATCH] sysfs: Replace %p with %pK in the warning of sysfs_emit*

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@...gle.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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ