]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
driver: Correctly tag kmalloc allocation on behalf of user space
authorJan Kiszka <jan.kiszka@siemens.com>
Wed, 11 Mar 2015 06:39:43 +0000 (07:39 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 20 Mar 2015 06:10:39 +0000 (07:10 +0100)
When the provided config size if beyond kmalloc limits, it may raise a
WARN_ON. Avoid this by tagging the allocation with __GFP_NOWARN. Also
properly tag it as GFP_USER instead of GFP_KERNEL.

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

index 07eb602346c0036562616ee1396ef4da6a8dab10..89d1141d3e316f7ef352d727a393340e34a2d7b4 100644 (file)
@@ -161,7 +161,7 @@ int jailhouse_cmd_cell_create(struct jailhouse_cell_create __user *arg)
        if (copy_from_user(&cell_params, arg, sizeof(cell_params)))
                return -EFAULT;
 
-       config = kmalloc(cell_params.config_size, GFP_KERNEL | GFP_DMA);
+       config = kmalloc(cell_params.config_size, GFP_USER | __GFP_NOWARN);
        if (!config)
                return -ENOMEM;