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] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160608111223.GA5772@gmail.com>
Date:	Wed, 8 Jun 2016 13:12:23 +0200
From:	Ingo Molnar <mingo@...nel.org>
To:	Joseph Thelen <jthelen@....com>
Cc:	linux-kernel@...r.kernel.org, Alex Thorlton <athorlton@....com>,
	Matt Fleming <matt@...eblueprint.co.uk>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	linux-efi@...r.kernel.org
Subject: Re: [PATCH] x86/efi: Auto enable EFI memmap on SGI UV systems


* Joseph Thelen <jthelen@....com> wrote:

>  static int __init setup_add_efi_memmap(char *arg)
>  {
> +	static bool arg_as_bool;

Why hidden inside local variables as static?

> +	int ret = strtobool(arg, &arg_as_bool);
> +
> +	/* check for a non-existent arg, to maintain backward compatibility */
> +	if (!arg) {
> +		add_efi_memmap = EFI_MEMMAP_ENABLED;
> +	} else {
> +		if (ret) {
> +			/* a bad argument was passed... */
> +			return ret;
> +		} else {
> +			if (arg_as_bool)
> +				add_efi_memmap = EFI_MEMMAP_ENABLED;
> +			else
> +				add_efi_memmap = EFI_MEMMAP_DISABLED;
> +		}
> +	}
> +
>  	return 0;

And that's a really weird code flow!

How about something straightforward:

	int val = 0;
	int ret;

	/* Check for a non-existent arg, to maintain backward compatibility: */
	if (!arg) {
		add_efi_memmap = EFI_MEMMAP_ENABLED;
		return 0;
	}

	ret = strtobool(arg, &val);

	/* Was a bad argument passed? */
	if (ret)
		return ret;

	if (val)
		add_efi_memmap = EFI_MEMMAP_ENABLED;
	else
		add_efi_memmap = EFI_MEMMAP_DISABLED;

	return 0;

?

Also note the rename to 'val'.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ