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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87364hge7t.fsf@jogness.linutronix.de>
Date:   Fri, 21 Aug 2020 00:17:18 +0206
From:   John Ogness <john.ogness@...utronix.de>
To:     Joe Perches <joe@...ches.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>
Cc:     Petr Mladek <pmladek@...e.com>,
        Sergey Senozhatsky <sergey.senozhatsky.work@...il.com>,
        Steven Rostedt <rostedt@...dmis.org>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [RFC PATCH 2/5] sysrq: use pr_cont_t for cont messages

On 2020-08-20, Joe Perches <joe@...ches.com> wrote:
> And here it seems like the 'for (j =...)' loop is superfluous.

AFAICT it is skipping duplicate entries. In the case of a duplicate,
only the first one is printed.

> Maybe something like this would be reasonable:
> ---
>  drivers/tty/sysrq.c | 19 ++++++-------------
>  1 file changed, 6 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index a8e39b2cdd55..a145e4fc1a2a 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -572,21 +572,14 @@ void __handle_sysrq(int key, bool check_mask)
>  			console_loglevel = orig_log_level;
>  		}
>  	} else {
> -		pr_info("HELP : ");
> -		/* Only print the help msg once per handler */
> +		pr_context c;
> +		pr_info_start(&c, "HELP :");
>  		for (i = 0; i < ARRAY_SIZE(sysrq_key_table); i++) {
> -			if (sysrq_key_table[i]) {
> -				int j;
> -
> -				for (j = 0; sysrq_key_table[i] !=
> -						sysrq_key_table[j]; j++)
> -					;
> -				if (j != i)
> -					continue;
> -				pr_cont("%s ", sysrq_key_table[i]->help_msg);
> -			}
> +			if (!sysrq_key_table[i])
> +				continue;
> +			pr_next(&c, " %s", sysrq_key_table[i]->help_msg);
>  		}
> -		pr_cont("\n");
> +		pr_end(&c, "\n");
>  		console_loglevel = orig_log_level;
>  	}
>  	rcu_read_unlock();

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ