Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp198738rwo; Fri, 21 Jul 2023 10:25:44 -0700 (PDT) X-Google-Smtp-Source: APBJJlE9NaT1EN37LLYkQI6fnT1j8pDAFBzu+lUDx3SUoTe1dMA1iJjOngoMZiZcbUqLEw6PURES X-Received: by 2002:a05:6358:9197:b0:135:a10e:1ed0 with SMTP id j23-20020a056358919700b00135a10e1ed0mr543053rwa.23.1689960343959; Fri, 21 Jul 2023 10:25:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689960343; cv=none; d=google.com; s=arc-20160816; b=HMQmzkspzdlRC6Uidmr8IKzET3obkFguxra4yW6j9QLN35z3J++bjwAep2tGCtiZ3o H5Fedakk+1JDCbqoFi9GhyVijsaDKUccspY57d1CfJq4MruJ89rmiKjyiBkH2Knof0L8 1zVYILGEqSPEN/oBq0o8Et5+dwJJtzq3U9jW/OIb5/EuahavDsIQ0S6fKv953xXXUH3p nT5HsSrJ7+Ko8url9iTE9fQkKPmuzCAjU0ITpGXSEgAI/e/uJYRMS92z2ObdOomh5NNi RYcPZxG7+jpVluoZWsW1Q0bweuvtEUhq8OxtdpDToaWxOhFXLBhMbhsqB47Kkx8m/ccR +Hqw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :content-language:references:cc:to:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=SofxeuaexXoVGK42MZB8nd198xjokjbrrVTRA9SKYtw=; fh=VDWoytJDKsyT6nDIHPARDT5i0d3Ih3lEiaX+eAVHXoo=; b=CIOOllmoX1jtoJ5dQZX2jOX8TUYTNgO7ILroNfJ7Z3s9hiWAi+YBLYZEgkelCE6QYB DpAWzYUyYteZ7vgZ1dK28osTUDGiG0Jk3MS7UvSFbVeZNBPp/QUo0nC8PPSkN+k73FBw MXDVAAavY3nz5j7k4wYMarKC5zYyeHTmILu/50qzw1dCGBaj24zOukGR7+zNQl7cXwDo eUshtulh0ShqAnOKGCDrlMFfvoyRhYYN7GBBCVX7xgvDon4tX+MTkUKC8XO2ePKt0Pyc JEkQ2H/LkxycfClJu5UjM1k9fBw0F8ZQ5ImI/mFL4TCWJrdK9vkL7l/T2ZrtXdE6/9L1 aYkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=lOexLpZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a630c06000000b005533750837csi3311738pgl.681.2023.07.21.10.25.31; Fri, 21 Jul 2023 10:25:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@wanadoo.fr header.s=t20230301 header.b=lOexLpZV; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229960AbjGURGJ (ORCPT + 99 others); Fri, 21 Jul 2023 13:06:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57694 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229708AbjGURGI (ORCPT ); Fri, 21 Jul 2023 13:06:08 -0400 Received: from smtp.smtpout.orange.fr (smtp-24.smtpout.orange.fr [80.12.242.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB51210CB for ; Fri, 21 Jul 2023 10:06:03 -0700 (PDT) Received: from [192.168.1.18] ([86.243.2.178]) by smtp.orange.fr with ESMTPA id MtZlqv15ZztjnMtZlqN0fo; Fri, 21 Jul 2023 19:06:01 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wanadoo.fr; s=t20230301; t=1689959161; bh=SofxeuaexXoVGK42MZB8nd198xjokjbrrVTRA9SKYtw=; h=Date:Subject:To:Cc:References:From:In-Reply-To; b=lOexLpZVe1t6hR6kg1Cur8dITSWx7YvByn1H9i2JqkPO6f/6TkvNWHYczWmTe2itl O1qUievB28yOYaowg0E52YBjiJo6kTkXrMHtunnpU/Ol4y5z06bp6yrhWaMI126EGS pjpI7sw7DiOY15XwZ3ddO971kzEmGpNi31DdkEmSCuTgwI9uvXBdYmcbktK+03ClqH zjDrcqmhmCFaWMoO+/8QtG61RWTsUFRhPybVAyqDT+9MCwWcUYxBS6XmlsV1/Ljo0t L3ZU7DNtLfFkX+hitNTfLkb29wjWcAM2yNYFJpiosRyK2/lFEW/85BPaAn9Jdokznd rxyEk0JPrpvkQ== X-ME-Helo: [192.168.1.18] X-ME-Auth: Y2hyaXN0b3BoZS5qYWlsbGV0QHdhbmFkb28uZnI= X-ME-Date: Fri, 21 Jul 2023 19:06:01 +0200 X-ME-IP: 86.243.2.178 Message-ID: <4fcb0507-d483-e49c-be9e-389d96187fc5@wanadoo.fr> Date: Fri, 21 Jul 2023 19:05:57 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH] lib/string_helpers: Use passed in GFP_ flags To: Andy Shevchenko , Dan Carpenter Cc: Michal Hocko , Andrew Morton , Stephen Rothwell , Mel Gorman , Vlastimil Babka , linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org References: Content-Language: fr, en-US From: Christophe JAILLET In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H5,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 21/07/2023 à 17:08, Andy Shevchenko a écrit : > 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 Hi, just for the records, see [1]. Another approach was proposed by Michal Hocko in [2]. CJ [1]: https://lore.kernel.org/all/1ec96b6e4f2e35599931d7516c6938c4a8845bf0.1642337606.git.christophe.jaillet@wanadoo.fr/ [2]: https://lore.kernel.org/all/YeWOd2G69LyR3PVZ@dhcp22.suse.cz/ > >> Fixes: 0ee931c4e31a ("mm: treewide: remove GFP_TEMPORARY allocation flag") >> Signed-off-by: Dan Carpenter >> --- >> 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("", 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.39.2 >> >