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-prev] [day] [month] [year] [list]
Message-ID: <2025040313-gem-nephew-2327@gregkh>
Date: Thu, 3 Apr 2025 09:19:21 +0100
From: Greg KH <gregkh@...uxfoundation.org>
To: xiaopeitux@...mail.com
Cc: jirislaby@...nel.org, linux-serial@...r.kernel.org,
	linux-kernel@...r.kernel.org, Pei Xiao <xiaopei01@...inos.cn>
Subject: Re: [PATCH] tty/sysrq: make sysrq_replay_logs_op const and refactor
 sysrq_mask()

On Thu, Apr 03, 2025 at 03:15:35PM +0800, xiaopeitux@...mail.com wrote:
> From: Pei Xiao <xiaopei01@...inos.cn>
> 
> Mark sysrq_replay_logs_op as const and simplify sysrq_mask().
> 
> Signed-off-by: Pei Xiao <xiaopei01@...inos.cn>
> ---
>  drivers/tty/sysrq.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
> index f85ce02e4725..c2a26abcb8cd 100644
> --- a/drivers/tty/sysrq.c
> +++ b/drivers/tty/sysrq.c
> @@ -71,9 +71,7 @@ static bool sysrq_on(void)
>   */
>  int sysrq_mask(void)
>  {
> -	if (sysrq_always_enabled)
> -		return 1;
> -	return sysrq_enabled;
> +	return sysrq_always_enabled ? 1 : sysrq_enabled;

That's not simpler, it's now harder to read and parse.  Only use ?: in C
for places it has to be used, not for stuff like this where it's more
obvious if you use an if () line.

We write code for people first, compilers second.

Also, you can't do two different things in the same commit, sorry.

thanks,

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ