Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, boot: Pass cmd_line_ptr with unsigned long instead

boot/compressed/misc.c is used for bzImage in 64bit and 32bit, and
cmd_line_ptr could point to buffer that is above 4g, cmd_line_ptr
should be 64bit otherwise high 32bit will be capped out.

So need to change data type to unsigned long, that will be 64bit get
correct address of command line buffer.

And it is still ok with 32bit bzImage, because unsigned long on 32bit kernel
is still 32bit.

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1359058816-7615-19-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

authored by

Yinghai Lu and committed by
H. Peter Anvin
3db07e70 16a4baa6

+6 -6
+4 -4
arch/x86/boot/boot.h
··· 285 285 void intcall(u8 int_no, const struct biosregs *ireg, struct biosregs *oreg); 286 286 287 287 /* cmdline.c */ 288 - int __cmdline_find_option(u32 cmdline_ptr, const char *option, char *buffer, int bufsize); 289 - int __cmdline_find_option_bool(u32 cmdline_ptr, const char *option); 288 + int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *buffer, int bufsize); 289 + int __cmdline_find_option_bool(unsigned long cmdline_ptr, const char *option); 290 290 static inline int cmdline_find_option(const char *option, char *buffer, int bufsize) 291 291 { 292 - u32 cmd_line_ptr = boot_params.hdr.cmd_line_ptr; 292 + unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr; 293 293 294 294 if (cmd_line_ptr >= 0x100000) 295 295 return -1; /* inaccessible */ ··· 299 299 300 300 static inline int cmdline_find_option_bool(const char *option) 301 301 { 302 - u32 cmd_line_ptr = boot_params.hdr.cmd_line_ptr; 302 + unsigned long cmd_line_ptr = boot_params.hdr.cmd_line_ptr; 303 303 304 304 if (cmd_line_ptr >= 0x100000) 305 305 return -1; /* inaccessible */
+2 -2
arch/x86/boot/cmdline.c
··· 27 27 * Returns the length of the argument (regardless of if it was 28 28 * truncated to fit in the buffer), or -1 on not found. 29 29 */ 30 - int __cmdline_find_option(u32 cmdline_ptr, const char *option, char *buffer, int bufsize) 30 + int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *buffer, int bufsize) 31 31 { 32 32 addr_t cptr; 33 33 char c; ··· 99 99 * Returns the position of that option (starts counting with 1) 100 100 * or 0 on not found 101 101 */ 102 - int __cmdline_find_option_bool(u32 cmdline_ptr, const char *option) 102 + int __cmdline_find_option_bool(unsigned long cmdline_ptr, const char *option) 103 103 { 104 104 addr_t cptr; 105 105 char c;