From patchwork Mon Oct 15 07:40:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sharat Masetty X-Patchwork-Id: 10641225 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A58893C13 for ; Mon, 15 Oct 2018 07:40:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99B2929548 for ; Mon, 15 Oct 2018 07:40:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DFE82954A; Mon, 15 Oct 2018 07:40:30 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.7 required=2.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C57C29548 for ; Mon, 15 Oct 2018 07:40:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726605AbeJOPYd (ORCPT ); Mon, 15 Oct 2018 11:24:33 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:33388 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726098AbeJOPYd (ORCPT ); Mon, 15 Oct 2018 11:24:33 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id A5FEA612EE; Mon, 15 Oct 2018 07:40:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539589228; bh=MxqOKQIJXhqnwFeNXvwCIfN3fc4PCTE4h8yxLXJMZBk=; h=From:To:Cc:Subject:Date:From; b=L2VJiDIzOISUSrIhWm4naoaPgDlibGnfH6vnmt9HMoNJJOOfcXWWN0AY6mtX5ol+H u53i6gCGD94/Ls7nGI5frPqnvIDAfvcfqZietL1TqOm/6g8YMUrsvVRH5VFpHnpXbV WxYPGh7seipAuG3ZVJeg36AAdGBZ4NG8/0gZcwP4= Received: from smasetty-linux.qualcomm.com (blr-c-bdr-fw-01_globalnat_allzones-outside.qualcomm.com [103.229.19.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: smasetty@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 364BC60C4B; Mon, 15 Oct 2018 07:40:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1539589228; bh=MxqOKQIJXhqnwFeNXvwCIfN3fc4PCTE4h8yxLXJMZBk=; h=From:To:Cc:Subject:Date:From; b=L2VJiDIzOISUSrIhWm4naoaPgDlibGnfH6vnmt9HMoNJJOOfcXWWN0AY6mtX5ol+H u53i6gCGD94/Ls7nGI5frPqnvIDAfvcfqZietL1TqOm/6g8YMUrsvVRH5VFpHnpXbV WxYPGh7seipAuG3ZVJeg36AAdGBZ4NG8/0gZcwP4= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 364BC60C4B Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=smasetty@codeaurora.org From: Sharat Masetty To: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org, Sharat Masetty Subject: [PATCH] lib/string: Pass the input gfp flags to kmalloc Date: Mon, 15 Oct 2018 13:10:15 +0530 Message-Id: <1539589215-6461-1-git-send-email-smasetty@codeaurora.org> X-Mailer: git-send-email 1.9.1 Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Pass the user sent gfp flags to kmalloc() calls. This helps calling the functions in user desired contexts. Signed-off-by: Sharat Masetty --- lib/string_helpers.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/string_helpers.c b/lib/string_helpers.c index 29c490e..60f9015 100644 --- a/lib/string_helpers.c +++ b/lib/string_helpers.c @@ -576,7 +576,7 @@ char *kstrdup_quotable_cmdline(struct task_struct *task, gfp_t gfp) char *buffer, *quoted; int i, res; - buffer = kmalloc(PAGE_SIZE, GFP_KERNEL); + buffer = kmalloc(PAGE_SIZE, gfp); if (!buffer) return NULL; @@ -612,7 +612,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp) return kstrdup("", gfp); /* We add 11 spaces for ' (deleted)' to be appended */ - temp = kmalloc(PATH_MAX + 11, GFP_KERNEL); + temp = kmalloc(PATH_MAX + 11, gfp); if (!temp) return kstrdup("", gfp);