Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755462AbbBPLXt (ORCPT ); Mon, 16 Feb 2015 06:23:49 -0500 Received: from mga14.intel.com ([192.55.52.115]:22968 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754710AbbBPLXs (ORCPT ); Mon, 16 Feb 2015 06:23:48 -0500 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,587,1418112000"; d="scan'208";a="666989484" From: "Kirill A. Shutemov" To: Rusty Russell Cc: linux-kernel@vger.kernel.org, "Kirill A. Shutemov" , Dave Jones , Sasha Levin Subject: [PATCH] module: do not print allocation-fail warning on bogus user buffer size Date: Mon, 16 Feb 2015 13:23:03 +0200 Message-Id: <1424085783-200431-1-git-send-email-kirill.shutemov@linux.intel.com> X-Mailer: git-send-email 2.1.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1289 Lines: 37 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 Cc: Dave Jones Cc: Sasha Levin --- kernel/module.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/module.c b/kernel/module.c index b34813f725e9..f63e5e8f3385 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -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; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/