public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: Dan Carpenter <dan.carpenter@linaro.org>
Cc: Michal Hocko <mhocko@suse.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>,
	linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org
Subject: Re: [PATCH] lib/string_helpers: Use passed in GFP_ flags
Date: Fri, 21 Jul 2023 18:08:59 +0300	[thread overview]
Message-ID: <ZLqfizx5Xi9fOF6z@smile.fi.intel.com> (raw)
In-Reply-To: <df051844-0a73-4cf9-9719-a6001f1c9d5c@moroto.mountain>

On Fri, Jul 21, 2023 at 05:57:00PM +0300, Dan Carpenter wrote:
> This patch doesn't affect runtime because all the callers pass GFP_KERNEL
> as the allocation flags.  However, it should use the passed in "gfp" as
> the allocation flags.

Please, Cc Kees Cook as he stepped in as a maintainer of this in particular.

Reviewed-by: Andy Shevchenko <andy@kernel.org>

> Fixes: 0ee931c4e31a ("mm: treewide: remove GFP_TEMPORARY allocation flag")
> Signed-off-by: Dan Carpenter <dan.carpenter@linaro.org>
> ---
>  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 d3b1dd718daf..be517c25737d 100644
> --- a/lib/string_helpers.c
> +++ b/lib/string_helpers.c
> @@ -668,7 +668,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;
>  
> @@ -704,7 +704,7 @@ char *kstrdup_quotable_file(struct file *file, gfp_t gfp)
>  		return kstrdup("<unknown>", 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("<no_memory>", gfp);
>  
> -- 
> 2.39.2
> 

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-07-21 15:09 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-21 14:57 [PATCH] lib/string_helpers: Use passed in GFP_ flags Dan Carpenter
2023-07-21 15:08 ` Andy Shevchenko [this message]
2023-07-21 17:05   ` Christophe JAILLET

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZLqfizx5Xi9fOF6z@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mhocko@suse.com \
    --cc=sfr@canb.auug.org.au \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox