Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1381908

[PATCH 6/6] x86, KASLR: Rename "random" to "random_addr"

From Kees Cook <keescook@chromium.org>
Newsgroups linux.kernel
Subject [PATCH 6/6] x86, KASLR: Rename "random" to "random_addr"
Date 2016-04-18 18:50 +0200
Message-ID <rpkx5-lO-33@gated-at.bofh.it> (permalink)
References <rpkx3-lO-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


The variable "random" is also the name of a libc function. It's better
coding style to avoid overloading such things, so rename it to the more
accurate "random_addr".

Suggested-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/x86/boot/compressed/kaslr.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/arch/x86/boot/compressed/kaslr.c b/arch/x86/boot/compressed/kaslr.c
index 9e03190d00ad..9c29e7885ef0 100644
--- a/arch/x86/boot/compressed/kaslr.c
+++ b/arch/x86/boot/compressed/kaslr.c
@@ -312,7 +312,7 @@ unsigned char *choose_random_location(unsigned char *input,
 				      unsigned long output_size)
 {
 	unsigned long choice = (unsigned long)output;
-	unsigned long random;
+	unsigned long random_addr;
 
 #ifdef CONFIG_HIBERNATION
 	if (!cmdline_find_option_bool("kaslr")) {
@@ -333,17 +333,17 @@ unsigned char *choose_random_location(unsigned char *input,
 		       (unsigned long)output, output_size);
 
 	/* Walk e820 and find a random address. */
-	random = find_random_addr(choice, output_size);
-	if (!random) {
+	random_addr = find_random_addr(choice, output_size);
+	if (!random_addr) {
 		debug_putstr("KASLR could not find suitable E820 region...\n");
 		goto out;
 	}
 
 	/* Always enforce the minimum. */
-	if (random < choice)
+	if (random_addr < choice)
 		goto out;
 
-	choice = random;
+	choice = random_addr;
 out:
 	return (unsigned char *)choice;
 }
-- 
2.6.3

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/6] x86, boot: clean up KASLR code Kees Cook <keescook@chromium.org> - 2016-04-18 18:50 +0200
  [PATCH 1/6] x86, KASLR: rename aslr.c to kaslr.c Kees Cook <keescook@chromium.org> - 2016-04-18 18:50 +0200
    [tip:x86/boot] x86/KASLR: Rename aslr.c to kaslr.c tip-bot for Kees Cook <tipbot@zytor.com> - 2016-04-19 11:40 +0200
  [PATCH 5/6] x86, KASLR: Clarify purpose of kaslr.c Kees Cook <keescook@chromium.org> - 2016-04-18 18:50 +0200
    [tip:x86/boot] x86/KASLR: Clarify purpose of kaslr.c tip-bot for Kees Cook <tipbot@zytor.com> - 2016-04-19 11:40 +0200
  [PATCH 4/6] x86, boot: Clarify purpose of functions in misc.c Kees Cook <keescook@chromium.org> - 2016-04-18 18:50 +0200
    [tip:x86/boot] x86/boot: Clarify purpose of functions in misc.c tip-bot for Kees Cook <tipbot@zytor.com> - 2016-04-19 11:40 +0200
  [PATCH 6/6] x86, KASLR: Rename "random" to "random_addr" Kees Cook <keescook@chromium.org> - 2016-04-18 18:50 +0200
    [tip:x86/boot] x86/KASLR: Rename "random" to "random_addr" tip-bot for Kees Cook <tipbot@zytor.com> - 2016-04-19 11:40 +0200
  Re: [PATCH 0/6] x86, boot: clean up KASLR code Ingo Molnar <mingo@kernel.org> - 2016-04-19 10:40 +0200

csiph-web