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]
Date:	Tue, 9 Feb 2016 14:13:26 +0100
From:	Ingo Molnar <mingo@...nel.org>
To:	Alexander Kuleshov <kuleshovmail@...il.com>
Cc:	Ingo Molnar <mingo@...hat.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	"H . Peter Anvin" <hpa@...or.com>, Borislav Petkov <bp@...e.de>,
	Joerg Roedel <jroedel@...e.de>, Dave Young <dyoung@...hat.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Jiri Kosina <jkosina@...e.cz>, Baoquan He <bhe@...hat.com>,
	Paolo Bonzini <pbonzini@...hat.com>,
	Mark Salter <msalter@...hat.com>, linux-kernel@...r.kernel.org,
	x86@...nel.org
Subject: Re: [PATCH v3] x86/setup: get ramdisk parameters only once


* Alexander Kuleshov <kuleshovmail@...il.com> wrote:

> +/*
> + * ramdisk setup
> + */
> +struct ramdisk {
> +	u64 image;
> +	u64 size;
> +	u64 end;
> +};

So what exactly are 'image' and 'end'? The names are not self-descriptory. Please 
add comments that describe them and use the opportunity to rename the fields to 
more self-descriptory names.

> +static void __init relocate_initrd(struct ramdisk ramdisk)

Why pass by value, why not by address?

>  {
> +	u64 area_size     = PAGE_ALIGN(ramdisk.size);

Why introduce a local variable here? Also, isn't ramdisk.size already page 
aligned?

> +static void __init early_reserve_initrd(struct ramdisk ramdisk)
>  {
> +	memblock_reserve(ramdisk.image, ramdisk.end - ramdisk.image);
>  }

Looks like a pretty pointless function now - can be expanded into its call site.

>  void __init setup_arch(char **cmdline_p)
>  {
> +	struct ramdisk ramdisk_image = {
> +		.image = get_ramdisk_image(),
> +		.size  = get_ramdisk_size(),
> +		/* Assume only end is not page aligned */
> +		.end = PAGE_ALIGN(ramdisk_image.image + ramdisk_image.size)
> +	};
> +	bool reserve_ramdisk = true;

Why not merge 'reserve_ramdisk' into the ramdisk state structure as well?

> -	early_reserve_initrd();
> +	if (!boot_params.hdr.type_of_loader || !ramdisk_image.image
> +		|| !ramdisk_image.size) {
> +		reserve_ramdisk = false;
> +		return;		/* No initrd provided by bootloader */
> +	} else
> +		early_reserve_initrd(ramdisk_image);

Curly braces should be balanced.

Thanks,

	Ingo

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ