Skip to content

Commit

Permalink
module: do not print allocation-fail warning on bogus user buffer size
Browse files Browse the repository at this point in the history
init_module(2) passes user-specified buffer length directly to
vmalloc(). It makes warn_alloc_failed() to print out a lot of info into
dmesg if user specified insane size, like -1.

Let's silence the warning. It doesn't add much value to -ENOMEM return
code. Without the patch the syscall is prohibitive noisy for testing
with trinity.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Kirill A. Shutemov authored and Rusty Russell committed Mar 24, 2015
1 parent 7b63c3a commit cc9e605
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/module.c
Original file line number Diff line number Diff line change
Expand Up @@ -2494,7 +2494,8 @@ static int copy_module_from_user(const void __user *umod, unsigned long len,
return err;

/* Suck in entire file: we'll want most of it. */
info->hdr = vmalloc(info->len);
info->hdr = __vmalloc(info->len,
GFP_KERNEL | __GFP_HIGHMEM | __GFP_NOWARN, PAGE_KERNEL);
if (!info->hdr)
return -ENOMEM;

Expand Down

0 comments on commit cc9e605

Please sign in to comment.