Re: [PATCH 2/2] lib/vsprintf: reduce space taken by no_hash_pointers warning

Timur Tabi
2021-03-06T20:29:18Z

On Fri, Mar 5, 2021 at 1:46 PM Marco Elver <elver@google.com> wrote:
> +static const char no_hash_pointers_warning[8][55] __initconst = {
> + "******************************************************",
> + " NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE ",
> + " This system shows unhashed kernel memory addresses ",
> + " via the console, logs, and other interfaces. This ",
> + " might reduce the security of your system. ",
> + " If you see this message and you are not debugging ",
> + " the kernel, report this immediately to your system ",
> + " administrator! ",
> +};
> +
> static int __init no_hash_pointers_enable(char *str)
> {
> + /* Indices into no_hash_pointers_warning; -1 is an empty line. */
> + const int lines[] = { 0, 1, -1, 2, 3, 4, -1, 5, 6, 7, -1, 1, 0 };

You can save a few more bytes by making this an array of s8.

I agree with the __initconst. The rest seems overkill to me, but I
won't reject it.

Acked-by: Timur Tabi <timur@kernel.org>