Skip to contentSkip to conversation

init/main.c: add __force markup when casts to a __user pointer

PATCH In review Namhyung Kim 2 participants 2 messages Aug 15, 2010 – Aug 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 init/main.c: add __force markup when casts to a __user pointer

add __force markup when casts to a __user address space pointer. This removes following sparse warnings:

init/main.c:900:23: warning: cast adds address space to expression (<asn:1>) init/main.c:913:25: warning: cast adds address space to expression (<asn:1>)

---
 init/main.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
init/main.c +2 -2
index b06b8f2..5a0be5c 100644
@@ -897,7 +897,7 @@ static int __init kernel_init(void * unused)
 	do_basic_setup();
 
 	/* Open the /dev/console on the rootfs, this should never fail */
-	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
+	if (sys_open((const char __user __force *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 
 	(void) sys_dup(0);
@@ -910,7 +910,7 @@ static int __init kernel_init(void * unused)
 	if (!ramdisk_execute_command)
 		ramdisk_execute_command = "/init";
 
-	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
+	if (sys_access((const char __user __force *) ramdisk_execute_command, 0) != 0) {
 		ramdisk_execute_command = NULL;
 		prepare_namespace();
 	}
Signature · 1 line
1.7.0.4
Acked-by on v1 1/1
#1 lore raw
Quoted 7 lines · Namhyung Kim

add __force markup when casts to a __user address space pointer. This removes following sparse warnings:

init/main.c:900:23: warning: cast adds address space to expression (<asn:1>) init/main.c:913:25: warning: cast adds address space to expression (<asn:1>)

Thanks!

Quoted 34 lines

---
init/main.c | 4 ++--

1 files changed, 2 insertions(+), 2 deletions(-)
init/main.c +2 -2
index b06b8f2..5a0be5c 100644
@@ -897,7 +897,7 @@ static int __init kernel_init(void * unused)
 	do_basic_setup();
 
 	/* Open the /dev/console on the rootfs, this should never fail */
-	if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0)
+	if (sys_open((const char __user __force *) "/dev/console", O_RDWR, 0) < 0)
 		printk(KERN_WARNING "Warning: unable to open an initial console.\n");
 
 	(void) sys_dup(0);
@@ -910,7 +910,7 @@ static int __init kernel_init(void * unused)
 	if (!ramdisk_execute_command)
 		ramdisk_execute_command = "/init";
 
-	if (sys_access((const char __user *) ramdisk_execute_command, 0) != 0) {
+	if (sys_access((const char __user __force *) ramdisk_execute_command, 0) != 0) {
 		ramdisk_execute_command = NULL;
 		prepare_namespace();
 	}
Signature · 7 lines
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/