Commit c0f100c2 authored by David S. Miller's avatar David S. Miller

[KERNEL]: Some sparse fixes for init/main.c

1) Explicitly cast to __user in syscall invocations
   where we know we are in KERNEL_DS
2) Explicitly test against zero in assignment expression
   conditional.
parent e2834fd5
...@@ -186,7 +186,7 @@ void __devinit calibrate_delay(void) ...@@ -186,7 +186,7 @@ void __devinit calibrate_delay(void)
loops_per_jiffy = (1<<12); loops_per_jiffy = (1<<12);
printk("Calibrating delay loop... "); printk("Calibrating delay loop... ");
while (loops_per_jiffy <<= 1) { while ((loops_per_jiffy <<= 1) != 0) {
/* wait for "start of" clock tick */ /* wait for "start of" clock tick */
ticks = jiffies; ticks = jiffies;
while (ticks == jiffies) while (ticks == jiffies)
...@@ -632,7 +632,7 @@ static int init(void * unused) ...@@ -632,7 +632,7 @@ static int init(void * unused)
* check if there is an early userspace init. If yes, let it do all * check if there is an early userspace init. If yes, let it do all
* the work * the work
*/ */
if (sys_access("/init", 0) == 0) if (sys_access((const char __user *) "/init", 0) == 0)
execute_command = "/init"; execute_command = "/init";
else else
prepare_namespace(); prepare_namespace();
...@@ -646,7 +646,7 @@ static int init(void * unused) ...@@ -646,7 +646,7 @@ static int init(void * unused)
unlock_kernel(); unlock_kernel();
system_state = SYSTEM_RUNNING; system_state = SYSTEM_RUNNING;
if (sys_open("/dev/console", O_RDWR, 0) < 0) if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
printk("Warning: unable to open an initial console.\n"); printk("Warning: unable to open an initial console.\n");
(void) sys_dup(0); (void) sys_dup(0);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment