vsprintf.c (9d4d8572a539ef807e21c196f145aa365fd52f0e) vsprintf.c (5ead723a20e0447bc7db33dc3070b420e5f80aa6)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/lib/vsprintf.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 */
7
8/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */

--- 2076 unchanged lines hidden (view full) ---

2085 default:
2086 buf = fwnode_full_name_string(fwnode, buf, end);
2087 break;
2088 }
2089
2090 return widen_string(buf, buf - buf_start, end, spec);
2091}
2092
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * linux/lib/vsprintf.c
4 *
5 * Copyright (C) 1991, 1992 Linus Torvalds
6 */
7
8/* vsprintf.c -- Lars Wirzenius & Linus Torvalds. */

--- 2076 unchanged lines hidden (view full) ---

2085 default:
2086 buf = fwnode_full_name_string(fwnode, buf, end);
2087 break;
2088 }
2089
2090 return widen_string(buf, buf - buf_start, end, spec);
2091}
2092
2093/* Disable pointer hashing if requested */
2094bool no_hash_pointers __ro_after_init;
2095EXPORT_SYMBOL_GPL(no_hash_pointers);
2096
2097static int __init no_hash_pointers_enable(char *str)
2098{
2099 no_hash_pointers = true;
2100
2101 pr_warn("**********************************************************\n");
2102 pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
2103 pr_warn("** **\n");
2104 pr_warn("** This system shows unhashed kernel memory addresses **\n");
2105 pr_warn("** via the console, logs, and other interfaces. This **\n");
2106 pr_warn("** might reduce the security of your system. **\n");
2107 pr_warn("** **\n");
2108 pr_warn("** If you see this message and you are not debugging **\n");
2109 pr_warn("** the kernel, report this immediately to your system **\n");
2110 pr_warn("** administrator! **\n");
2111 pr_warn("** **\n");
2112 pr_warn("** NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE **\n");
2113 pr_warn("**********************************************************\n");
2114
2115 return 0;
2116}
2117early_param("no_hash_pointers", no_hash_pointers_enable);
2118
2093/*
2094 * Show a '%p' thing. A kernel extension is that the '%p' is followed
2095 * by an extra set of alphanumeric characters that are extended format
2096 * specifiers.
2097 *
2098 * Please update scripts/checkpatch.pl when adding/removing conversion
2099 * characters. (Search for "check for vsprintf extension").
2100 *

--- 191 unchanged lines hidden (view full) ---

2292 switch (fmt[1]) {
2293 case 's':
2294 return string(buf, end, ptr, spec);
2295 default:
2296 return error_string(buf, end, "(einval)", spec);
2297 }
2298 }
2299
2119/*
2120 * Show a '%p' thing. A kernel extension is that the '%p' is followed
2121 * by an extra set of alphanumeric characters that are extended format
2122 * specifiers.
2123 *
2124 * Please update scripts/checkpatch.pl when adding/removing conversion
2125 * characters. (Search for "check for vsprintf extension").
2126 *

--- 191 unchanged lines hidden (view full) ---

2318 switch (fmt[1]) {
2319 case 's':
2320 return string(buf, end, ptr, spec);
2321 default:
2322 return error_string(buf, end, "(einval)", spec);
2323 }
2324 }
2325
2300 /* default is to _not_ leak addresses, hash before printing */
2301 return ptr_to_id(buf, end, ptr, spec);
2326 /*
2327 * default is to _not_ leak addresses, so hash before printing,
2328 * unless no_hash_pointers is specified on the command line.
2329 */
2330 if (unlikely(no_hash_pointers))
2331 return pointer_string(buf, end, ptr, spec);
2332 else
2333 return ptr_to_id(buf, end, ptr, spec);
2302}
2303
2304/*
2305 * Helper function to decode printf style format.
2306 * Each call decode a token from the format and return the
2307 * number of characters read (or likely the delta where it wants
2308 * to go on the next call).
2309 * The decoded token is returned through the parameters

--- 1222 unchanged lines hidden ---
2334}
2335
2336/*
2337 * Helper function to decode printf style format.
2338 * Each call decode a token from the format and return the
2339 * number of characters read (or likely the delta where it wants
2340 * to go on the next call).
2341 * The decoded token is returned through the parameters

--- 1222 unchanged lines hidden ---