Received: by 2002:a05:6a10:af89:0:0:0:0 with SMTP id iu9csp3058031pxb; Mon, 24 Jan 2022 01:12:29 -0800 (PST) X-Google-Smtp-Source: ABdhPJy+WHW0EKR1qYwq4MgcwcTI7upsV/1g/SSjXXOFUD2S2Yal1uiCF9Rj7FubEiiwHETe57iR X-Received: by 2002:a17:902:e841:b0:14b:661c:f92c with SMTP id t1-20020a170902e84100b0014b661cf92cmr310162plg.171.1643015549700; Mon, 24 Jan 2022 01:12:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1643015549; cv=none; d=google.com; s=arc-20160816; b=OEdEFguasMizaqLEbYq32VEQQeTHgbAVxh7C7NXROookcXa7XTNMv/dhvU2SQVd5IV qNirPWCdxeHIHrcVpzdiApHh3lbGJ3yOsCvGBYdRFmdH4Gcb8ijWhRcu97cELrASp6d8 bgadxCT0h4sBTpmzz7oQ7KwyzzhpoZwhF1oC3dZHI9V97U6FrxUbIii+BuVs7tUKSlRr BBFk+16R37Hb9xpdr7TMOHDTpLRHMit50UCRVVnhP3H2JElCoe2Ysl++AD+7zkCKvyyR zfDWUh7FbYujvD4Gsosn1AsTLwo9kPGvuVZaRhkpIMxm2N2sBadWiFtnTs5OF4a0vEwy ycRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=6hQZBPknnRdcWgKsFRCk6L4lu1f0oDpFYzGuA9VD77o=; b=TwBDeiUTqIvc48tU7PluTjkbfehzEFO/TsmyibeHqnqbbqLUJuV9RTqKdf2QjJtA0c EWdfnCeDAvsvmYmnPsAYY065ghn/S9xTbfV7E/sQDlSwr3XHS+I8L9W9FAEnZ/XujnD1 085eUNTjXZOURq64t6HUioxQcC8TLe1muRFhhn0OBKtuMhlPtqBql+8MjN3eFNKkQbhZ Zz/PKOYrMShSeUOg6PV3J80DrJx/79pWkfNHdPUfUs4gYPQjQWUwuHx6eBQ6Sv+u+YJC nSaAXGw3DJ3ahhb01qLxioXwWyDbvKZXV2WruWUCRb8u06rFjBqhgKRmCN7B5Fpjs5Fi zXcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=mRCfqJbZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y128si14450921pfb.165.2022.01.24.01.12.17; Mon, 24 Jan 2022 01:12:29 -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=@gmail.com header.s=20210112 header.b=mRCfqJbZ; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233137AbiAWNz4 (ORCPT + 99 others); Sun, 23 Jan 2022 08:55:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44504 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232042AbiAWNzz (ORCPT ); Sun, 23 Jan 2022 08:55:55 -0500 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E4120C06173B; Sun, 23 Jan 2022 05:55:54 -0800 (PST) Received: by mail-ej1-x636.google.com with SMTP id p15so14022765ejc.7; Sun, 23 Jan 2022 05:55:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=6hQZBPknnRdcWgKsFRCk6L4lu1f0oDpFYzGuA9VD77o=; b=mRCfqJbZsNf8IiAhuwfMcUd3mSFoesuaH29GAQR8qcXTEQBI3To2oddKPY7ZU1pwnp Ph/FpYLiGE0PAInkQouB8cFJjysKuWCpPJABnFKUM04i+qR9v6vXtcLn+4Ncm1kx8L4D H/zxgC5727PeFZQtlqQ84aILr93pu5JQpo2KyPGPO3eO/Bq1rcN9qQg2DyGAIDQ85me8 E2RdDWFneFlMH6UpLdyoxwUlWcjVjw8Zevs+K7Prza8SV4kXg8lP/kiUOQtf7OIQn2DH jBKu/0mXrWdfYplhosjCoxRgdpH1cV1Oc5guRKx1A1cx9fxc3NabrtLknuerxHtHhCSN CGUA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=6hQZBPknnRdcWgKsFRCk6L4lu1f0oDpFYzGuA9VD77o=; b=mbecj7M6GU4Lq/nWayhT5HRz6LRCJBsQMEVXh69T4Voidt32EZlDPCpaL5rgDw+087 yhfRAdFPHlOG8FwrgsBK0fFo04r/QMpUFib2hnZEkbKQZDqooVYoHjA3enKCXrxOtJ+r RuLdG3XI018He/FUsSIAkBxtULfPIyRtMi/BnBoWoMkvBB++V57BCqj9ur+gnfHHS6gQ Dj4ed1Fkb3KvKa7mDkvgXQI/l4eFNWUlGDwF1cnuzjOso53pTt0xMVzBA5hQKnPgwSDO hnuNARpzDruuGfIn/LAkS03VhV6jTXoRh+s1gqLzXC8dMUCaspZDFyxrKgMeMWDAygwz FFKg== X-Gm-Message-State: AOAM530f94Hn69aT6mh4zTPxIR9UGQ1FCHA1FZoQPoNbsYDKXohI8FfL 7piCOHbBKLRnxjNVg6dzsQ== X-Received: by 2002:a17:907:720e:: with SMTP id dr14mr4848739ejc.146.1642946153336; Sun, 23 Jan 2022 05:55:53 -0800 (PST) Received: from localhost.localdomain ([46.53.248.28]) by smtp.gmail.com with ESMTPSA id h3sm5053638edq.83.2022.01.23.05.55.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 23 Jan 2022 05:55:53 -0800 (PST) Date: Sun, 23 Jan 2022 16:55:51 +0300 From: Alexey Dobriyan To: Hao Lee Cc: akpm@linux-foundation.org, christian.brauner@ubuntu.com, keescook@chromium.org, jamorris@linux.microsoft.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] proc: use kmalloc instead of __get_free_page() to alloc path buffer Message-ID: References: <20220123100837.GA1491@haolee.io> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220123100837.GA1491@haolee.io> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Jan 23, 2022 at 10:08:37AM +0000, Hao Lee wrote: > It's not a standard approach that use __get_free_page() to alloc path > buffer directly. We'd better use kmalloc and PATH_MAX. > --- a/fs/proc/base.c > +++ b/fs/proc/base.c > @@ -1764,25 +1764,26 @@ static const char *proc_pid_get_link(struct dentry *dentry, > > static int do_proc_readlink(struct path *path, char __user *buffer, int buflen) > { > - char *tmp = (char *)__get_free_page(GFP_KERNEL); > + char *buf = NULL; I'd rather not rename anything but keep it minimal.