linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL
@ 2017-01-04 10:19 Vlastimil Babka
  2017-01-04 12:15 ` Jiri Kosina
  0 siblings, 1 reply; 2+ messages in thread
From: Vlastimil Babka @ 2017-01-04 10:19 UTC (permalink / raw)
  To: Jiri Kosina; +Cc: linux-kernel, Vlastimil Babka, Matthew Wilcox

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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL
  2017-01-04 10:19 [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL Vlastimil Babka
@ 2017-01-04 12:15 ` Jiri Kosina
  0 siblings, 0 replies; 2+ messages in thread
From: Jiri Kosina @ 2017-01-04 12:15 UTC (permalink / raw)
  To: Vlastimil Babka; +Cc: linux-kernel, Matthew Wilcox

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-01-04 12:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-01-04 10:19 [PATCH] floppy: replace wrong kmalloc(GFP_USER) with GFP_KERNEL Vlastimil Babka
2017-01-04 12:15 ` Jiri Kosina

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).