Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3524225pxb; Mon, 24 Jan 2022 11:22:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJyvlNCXiRx3r3bU7X3A1uSQ6lEtZIvCJNpGBgOcC3b/VQeiPNPQ+FxxWjLLvLhut8/5UnyR X-Received: by 2002:a63:7050:: with SMTP id a16mr12855124pgn.282.1643052153589; Mon, 24 Jan 2022 11:22:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643052153; cv=none; d=google.com; s=arc-20160816; b=YNbUYptfK2HVhPcHFbcfBMK3zmvKUiCmXoznyc+acndYdf9GIfEDrea6WNuHFADzKD I+Xh4oTS4sf65/1wfqrBwwZEUrLvMpmHqDnMZRlgIfsuyuUG48VBhX8aGs+ZhWhtg7jF /wQIMccYAnub38wS5rKaE30+zlAlIy3Mi2+pNYAKEeplA+t0hTODz2Iey58kaT0WgNIg xG/c/bd/jwq3VZQR/GlzLZ0cyyx6AUT5Y4Bv3oIO3OlLjgcXVVliMUOdpOfzx5vCFbbx SW1kWp8vC/b2JhchLwQgEF7HqFPZdyJGP4ovC1IFY3VppruJkGsYC2Qhior7Gi5dB3Ya 76gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:organization:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mw16yHCufMyoct/muDGDaCx2pt//LYF1W+qfjkTar8g=; b=c0i3UgTW0wkECMYjeJj2NJbIQjKpB1otCXcY2EXiClid7cAJcoKRkNxQvTitzcsp82 o55LPWNUEksa/M5DV/0/pW1nKiMZswVXdR0NdE9FursG1XBOvKzfAbXMOuq34VlQ71yV S1oaTIVLbOMPCcyQ+vt8VY439qCh5Sp1D3zPkAMgXO/gZeneH3QkkdMNVdVId3GsPdT2 95y5hoPFl7crCYBegoYZOyxgGakUfcO9qGJJCNg3nlpZhZMmZlIOQZjUOOcwrwOULdcP k2TkhRZ2w5Gjk8lPaKdqzsUc4vcshk6uUIBvcEnTmg5SsVuihOB1QSGbkzTJ4O/7+IWm c9Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hlMfD539; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q70si2956188pgq.226.2022.01.24.11.22.19; Mon, 24 Jan 2022 11:22:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=hlMfD539; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238363AbiAXO1d (ORCPT + 99 others); Mon, 24 Jan 2022 09:27:33 -0500 Received: from mga01.intel.com ([192.55.52.88]:61621 "EHLO mga01.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238295AbiAXO1c (ORCPT ); Mon, 24 Jan 2022 09:27:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1643034452; x=1674570452; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=j2z/GmNDeCOiVJHcgh+l/bMe+jvLITsYaovOpxRgCec=; b=hlMfD539qiMfRLYrQACYhf0nWfRfNUkr2TAb4mw/30hHw4H7POe4RZbb mcTXVS5UtoVaMXJbz7KCDoUjKMi5WRpaYVf0lwYT69RbEzoE8kQWqwIK/ 7vgKlLnzoX+fbO26sOhd9C3nQFtUgv73O242b34cu1tI4SbxnATe/YRji x70OrswNfHKkPZD5EXJGKfiKC+u2shFeXCZGJ0mV5szoluBpIWItmS5ZY dtiRZLzIkgCSfUVqKVPqtUg69i9zvRYqe7WMiG0MZJB3F2jz6FEMYjMlO raN5BRBMOTDk1WIH4DUPzDcTX17TeVbA1aAAyrvopF9SiMXWVeIjJpUAa g==; X-IronPort-AV: E=McAfee;i="6200,9189,10236"; a="270491672" X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="270491672" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 06:27:32 -0800 X-IronPort-AV: E=Sophos;i="5.88,311,1635231600"; d="scan'208";a="532093032" Received: from smile.fi.intel.com ([10.237.72.61]) by fmsmga007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jan 2022 06:27:30 -0800 Received: from andy by smile.fi.intel.com with local (Exim 4.95) (envelope-from ) id 1nC0IZ-00DvFO-6W; Mon, 24 Jan 2022 16:26:23 +0200 Date: Mon, 24 Jan 2022 16:26:22 +0200 From: Andy Shevchenko To: Christophe JAILLET Cc: Andy Shevchenko , Vlastimil Babka , Andrew Morton , Mel Gorman , Michal Hocko , Stephen Rothwell , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org Subject: Re: [PATCH v2] lib/string_helpers: Use the given gfp flag when allocating memory Message-ID: References: <1ec96b6e4f2e35599931d7516c6938c4a8845bf0.1642337606.git.christophe.jaillet@wanadoo.fr> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1ec96b6e4f2e35599931d7516c6938c4a8845bf0.1642337606.git.christophe.jaillet@wanadoo.fr> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 16, 2022 at 01:53:37PM +0100, Christophe JAILLET wrote: > kstrdup_quotable_cmdline() and kstrdup_quotable_file() are given a gfp flag > that is passed and used for memory allocation in kstrdup_quotable() just a > few lines below. > > It looks reasonable to use this gfp value for the buffer allocated and > freed in these functions as well. Acked-by: Andy Shevchenko > Fixes: 0ee931c4e31a ("mm: treewide: remove GFP_TEMPORARY allocation flag") > Signed-off-by: Christophe JAILLET > --- > According to what I've found in 5.16, all callers use GFP_KERNEL, so this > patch should be a no-op. > But who knows how it will be used in the future. Better safe than sorry. > > v2: Add the change for kstrdup_quotable_file() > --- > 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 90f9f1b7afec..4433e486b725 100644 > --- a/lib/string_helpers.c > +++ b/lib/string_helpers.c > @@ -624,7 +624,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; > > @@ -660,7 +660,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); > > -- > 2.32.0 > -- With Best Regards, Andy Shevchenko