Skip to contentSkip to conversation

x86, kaslr: use char array to gain sizeof sanity

PATCH New Kees Cook 2 participants 2 messages Nov 12, 2013 x86

lore
Share & tools
lore

Kees Cook

author
#0 lore raw

PATCH 1/1 x86, kaslr: use char array to gain sizeof sanity

The build_str needs to be char [] not char * for the sizeof() to report the string length.

---
 arch/x86/boot/compressed/aslr.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/aslr.c +1 -1
index 8746487fa916..9777ed15fbb9 100644
@@ -13,7 +13,7 @@
 #include <linux/version.h>
 
 /* Simplified build-specific string for starting entropy. */
-static const char *build_str = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
+static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
 		LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
 
 #define I8254_PORT_CONTROL	0x43
Signature · 6 lines
1.7.9.5


-- 
Kees Cook
Chrome OS Security
#1 lore raw

[tip:x86/kaslr] x86, kaslr: Use char array to gain sizeof sanity

x86, kaslr: Use char array to gain sizeof sanity
Commit-ID:  327f7d72454aecdc7a4a1c847a291a3f224b730f
Gitweb:     http://git.kernel.org/tip/327f7d72454aecdc7a4a1c847a291a3f224b730f
Author:     Kees Cook <[email protected]>
AuthorDate: Tue, 12 Nov 2013 08:56:07 -0800
Committer:  H. Peter Anvin <[email protected]>
CommitDate: Tue, 12 Nov 2013 08:58:35 -0800

x86, kaslr: Use char array to gain sizeof sanity

The build_str needs to be char [] not char * for the sizeof() to report the string length.

---
 arch/x86/boot/compressed/aslr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/compressed/aslr.c +1 -1
index 38a07cc..84be175 100644
@@ -13,7 +13,7 @@
 #include <linux/version.h>
 
 /* Simplified build-specific string for starting entropy. */
-static const char *build_str = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
+static const char build_str[] = UTS_RELEASE " (" LINUX_COMPILE_BY "@"
 		LINUX_COMPILE_HOST ") (" LINUX_COMPILER ") " UTS_VERSION;
 
 #define I8254_PORT_CONTROL	0x43