]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
driver: Silence sparse warnings about incompatible address spaces
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 10 Mar 2015 13:26:55 +0000 (14:26 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 20 Mar 2015 06:10:39 +0000 (07:10 +0100)
All conversion cases are harmless, just ensure that sparse is told this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
driver/cell.c
driver/main.c

index e2622c2a612d85d3e9ff9eab70543db3b5db7156..c1721d1716ada4dfa0223e2a01450163b2fe5d51 100644 (file)
@@ -149,6 +149,7 @@ int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg)
        struct jailhouse_cell_create cell_params;
        struct jailhouse_cell_desc *config;
        struct jailhouse_cell_id cell_id;
+       void __user *user_config;
        struct cell *cell;
        unsigned int cpu;
        int id, err = 0;
@@ -160,9 +161,8 @@ int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg)
        if (!config)
                return -ENOMEM;
 
-       if (copy_from_user(config,
-                          (void *)(unsigned long)cell_params.config_address,
-                          cell_params.config_size)) {
+       user_config = (void __user *)(unsigned long)cell_params.config_address;
+       if (copy_from_user(config, user_config, cell_params.config_size)) {
                err = -EFAULT;
                goto kfree_config_out;
        }
@@ -298,7 +298,7 @@ static int load_image(struct cell *cell,
        }
 
        if (copy_from_user(image_mem,
-                          (void *)(unsigned long)image.source_address,
+                          (void __user *)(unsigned long)image.source_address,
                           image.size))
                err = -EFAULT;
 
index 8b9389b324a8bba8c93fa23bc9d683db9859030c..4721db7af15ee5efa8879c2883ab3aff5880f226 100644 (file)
@@ -92,7 +92,9 @@ static long get_max_cpus(u32 cpu_set_size,
                         const struct jailhouse_system __user *system_config)
 {
        u8 __user *cpu_set =
-               (u8 __user *)jailhouse_cell_cpu_set(&system_config->root_cell);
+               (u8 __user *)jailhouse_cell_cpu_set(
+                               (const struct jailhouse_cell_desc * __force)
+                               &system_config->root_cell);
        unsigned int pos = cpu_set_size;
        long max_cpu_id;
        u8 bitmap;
@@ -256,7 +258,9 @@ static int jailhouse_cmd_enable(struct jailhouse_system __user *arg)
                               (unsigned long)config->debug_uart.phys_start);
                        goto error_unmap;
                }
-               header->debug_uart_base = (void *)uart;
+               /* The hypervisor has no notion of address spaces, so we need
+                * to enforce conversion. */
+               header->debug_uart_base = (void * __force)uart;
        }
 
        err = jailhouse_cell_prepare_root(&config->root_cell);
@@ -326,7 +330,7 @@ static void leave_hypervisor(void *info)
         * not support taking any faults while switching worlds. */
        for (page = hypervisor_mem, size = hv_core_and_percpu_size; size > 0;
             size -= PAGE_SIZE, page += PAGE_SIZE)
-               readl(page);
+               readl((void __iomem *)page);
 
        /* either returns 0 or the same error code across all CPUs */
        err = jailhouse_call(JAILHOUSE_HC_DISABLE);