Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1550632 > unrolled thread

[PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL

Started byVlastimil Babka <vbabka@suse.cz>
First post2017-01-04 11:30 +0100
Last post2017-01-04 13:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL Vlastimil Babka <vbabka@suse.cz> - 2017-01-04 11:30 +0100
    Re: [PATCH] floppy: replace wrong kmalloc(GFP_USER) with  GFP_KERNEL Jiri Kosina <jikos@kernel.org> - 2017-01-04 13:30 +0100

#1550632 — [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL

FromVlastimil Babka <vbabka@suse.cz>
Date2017-01-04 11:30 +0100
Subject[PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL
Message-ID<sVQZs-3pc-53@gated-at.bofh.it>
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>
---
 drivers/block/floppy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index e3d8e4ced4a2..7f3e68acd787 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -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;
-- 
2.11.0

[toc] | [next] | [standalone]


#1550722 — Re: [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL

FromJiri Kosina <jikos@kernel.org>
Date2017-01-04 13:30 +0100
SubjectRe: [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL
Message-ID<sVSRA-4Ct-33@gated-at.bofh.it>
In reply to#1550632
On Wed, 4 Jan 2017, Vlastimil Babka wrote:

> 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>

Applied, thanks.

-- 
Jiri Kosina
SUSE Labs

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web