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]
Date:   Sun, 24 Oct 2021 12:39:29 +0200
From:   Johan Hovold <johan@...nel.org>
To:     Jim Christian Haukvik <jchaukvik@...il.com>
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] kernel/params.c: Refactor dash2underscore

On Sat, Oct 23, 2021 at 08:04:51PM +0200, Jim Christian Haukvik wrote:
> This patch refactors the dash2underscore function
> to use the ternary operator.
> 
> Signed-off-by: Jim Christian Haukvik <jchaukvik@...il.com>
> ---
>  kernel/params.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/kernel/params.c b/kernel/params.c
> index 8299bd764e42..865a76fec79a 100644
> --- a/kernel/params.c
> +++ b/kernel/params.c
> @@ -76,9 +76,7 @@ static void maybe_kfree_parameter(void *param)
>  
>  static char dash2underscore(char c)
>  {
> -	if (c == '-')
> -		return '_';
> -	return c;
> +	return (c == '-') ? '_' : c;
>  }

This is not an improvement. You're just making the code harder to read
for no good reason (the ternary operator tends to do so).

Johan

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ