floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL
authorVlastimil Babka <vbabka@suse.cz>
Wed, 4 Jan 2017 10:19:31 +0000 (11:19 +0100)
committerJens Axboe <axboe@fb.com>
Thu, 12 Jan 2017 03:47:08 +0000 (20:47 -0700)
The raw_cmd_copyin() function does a kmalloc() with GFP_USER, although the
allocated structure is obviously not mapped to userspace, just copied from/to.
In this case GFP_KERNEL is more appropriate, so let's use it, although in the
current implementation this does not manifest as any error.

Reported-by: Matthew Wilcox <mawilcox@linuxonhyperv.com>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/block/floppy.c

index a391a3cfb3fe6ef7c7b065cd9160671d58318ae5..184887af4b9fbbb365480a6e275544c501ae2b5a 100644 (file)
@@ -3119,7 +3119,7 @@ static int raw_cmd_copyin(int cmd, void __user *param,
        *rcmd = NULL;
 
 loop:
-       ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER);
+       ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_KERNEL);
        if (!ptr)
                return -ENOMEM;
        *rcmd = ptr;