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>] [day] [month] [year] [list]
Message-ID: <20130426200730.9729.qmail@science.horizon.com>
Date:	26 Apr 2013 16:07:30 -0400
From:	"George Spelvin" <linux@...izon.com>
To:	keescook@...omium.org
Cc:	linux@...izon.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 5/6] x86: kaslr: select memory region from e820 maps

As a logic simplification, the following gets rid of one variable
that's simply not needed.  (And adds a "static" declaration that seems
to be appropriate):

static bool largest_ram_region(unsigned long *start, unsigned long *size)
{
	int i;

	*size = 0;
	for (i = 0; i < real_mode->e820_entries; i++) {
		struct e820entry *entry = &real_mode->e820_map[i];

		if (entry->type != E820_RAM)
			continue;

		if (entry->size > *size) {
			*size = entry->size;
			*start = entry->addr;
		}
	}
	return *size != 0;
}

but I might instead do it as:

struct e820_entry const *largest_ram_region()
{
	struct e820_entry const *rc = NULL;
	unsigned long size = 0;
	int i;

	for (i = 0; i < real_mode->e820_entries; i++) {
		struct e820entry const *entry = &real_mode->e820_map[i];

		if (entry->type == E820_RAM && entry->size > size) {
			size = entry->size;
			rc = entry;
		}
	}
	return rc;
}

... with appropriate adjustments to the caller.  Anyway,
your choice.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ