mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] lib/string_helpers: Use the given gfp flag when allocating memory
@ 2022-01-16 12:49 Christophe JAILLET
  2022-01-16 12:54 ` Christophe JAILLET
  2022-01-17  9:51 ` Michal Hocko
  0 siblings, 2 replies; 5+ messages in thread
From: Christophe JAILLET @ 2022-01-16 12:49 UTC (permalink / raw)
  To: Andy Shevchenko, Stephen Rothwell, Andrew Morton, Mel Gorman,
	Michal Hocko, Vlastimil Babka
  Cc: linux-kernel, kernel-janitors, Christophe JAILLET

kstrdup_quotable_cmdline() is 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 kstrdup_quotable_cmdline() as well.

Fixes: 0ee931c4e31a ("mm: treewide: remove GFP_TEMPORARY allocation flag")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
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.
---
 lib/string_helpers.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/string_helpers.c b/lib/string_helpers.c
index 90f9f1b7afec..7aceeb40dfd7 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;
 
-- 
2.32.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-01-17 19:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-16 12:49 [PATCH] lib/string_helpers: Use the given gfp flag when allocating memory Christophe JAILLET
2022-01-16 12:54 ` Christophe JAILLET
2022-01-17  9:51 ` Michal Hocko
2022-01-17 15:42   ` Michal Hocko
2022-01-17 19:29     ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®