x86/boot: Check if the input parameter (buffer) of the function is a null pointer
Subsystems (6)
PATCH 1/1 x86/boot: Check if the input parameter (buffer) of the function is a null pointer
If the variable buffer is a null pointer, it may cause the kernel to crash.
Signed-off-by Liam Ni <[email protected]>
--- arch/x86/boot/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/boot/cmdline.c +1 -1
@@ -39,7 +39,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b st_bufcpy /* Copying this to buffer */ } state = st_wordstart; -if (!cmdline_ptr) +if (!cmdline_ptr || buffer ==NULL )return -1 ;/* No command line */ cptr = cmdline_ptr &0xf ;
Signature · 1 line
2.25.1
Quoted 12 lines · Liam Ni
If the variable buffer is a null pointer, it may cause the kernel to crash.
Signed-off-by Liam Ni <[email protected]>--- arch/x86/boot/cmdline.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)arch/x86/boot/cmdline.c +0
-0
arch/x86/boot/cmdline.c int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b · line 43
Quoted 6 lines
arch/x86/boot/cmdline.c +1
-1@@ -39,7 +39,7 @@ int __cmdline_find_option(unsigned long cmdline_ptr, const char *option, char *b st_bufcpy /* Copying this to buffer */ } state = st_wordstart; -if (!cmdline_ptr) +if (!cmdline_ptr || buffer ==NULL )return -1 ;/* No command line */
Can this ever happen?
Thanks,
Ingo