Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp99474pxv; Thu, 24 Jun 2021 03:49:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwbuhxEJdpNaqc+csSwRvdMAkhSE/BdZdIErfMwmbZwRbtJIAwuy8RCqR39Uij/GNVA3nNo X-Received: by 2002:a05:6402:c9a:: with SMTP id cm26mr6283779edb.57.1624531785884; Thu, 24 Jun 2021 03:49:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624531785; cv=none; d=google.com; s=arc-20160816; b=Cb8hm1bSe9aKkqVeYTIFYtRK9TAC4G64ZnBvSJhnISRIp7LBuD4G8EHY6f+jBViFho t/0OzyTHQ2lnY2sumLIDQ+XcM3u5QLgqzrpKAnAgF/Q0sUB3wKz+QmBhdkFkmw8x5W6K kOrqC3xPssU1Xsm/rOjEINr9OrxTTDAavH4hTGZUtUVnDwrf643E5UIVQuddtYWiDvQ7 AE//8Q5zv6f/rgd9aztIKBJ99te8RdQu4EZa0Ji0hNtkB41DVuOZCC6l9ZUFvuHm1doU XAQn03AeExZAOn2wmNzXMvAfkj/8ubD+RC7Om+2GWnPTaN8JeZECocEUVj/Rb/zR+QVu P9MQ== 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 :ironport-sdr:ironport-sdr; bh=kdXZGEtaKM6M7TQkr8b8l5K0kRHx1mQ/K0kg1a7ayvI=; b=bmgZYOpxX6pxRqz7VIkuhgu1+cKQpcS5wWnSzi0dH6Vx4nTj9TzXXB6xXD9sRNqqIK lshdqqzyTUktSKjJhHX0KffnPA4nY1MOLVML5xdqZO4h6kXsyjcH620mhjDB93HhV/U0 rIwHxKBrmTvsdd2uUcYLOKuVV1TgI18Zq9TfAMbnDbUwU7Vg/Q93i9BcNrsgx33gS7Xb mgvFOtZt/3klXMGep88cjzZ93m/Lf3Eppzv7KlRlmxwy4USuTUkNA2dTAQTvL8S/2+M3 o8dj7DmNzldZAn0XMoz+DWa7Us8JP3CsGr343RtVgCJQUzfvGzZRV2PTZg+rYxA9gE5i aCvA== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (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 f18si2608032edq.570.2021.06.24.03.49.23; Thu, 24 Jun 2021 03:49:45 -0700 (PDT) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232279AbhFXKuf (ORCPT + 99 others); Thu, 24 Jun 2021 06:50:35 -0400 Received: from mga12.intel.com ([192.55.52.136]:40968 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232254AbhFXKue (ORCPT ); Thu, 24 Jun 2021 06:50:34 -0400 IronPort-SDR: pBGr1bc1vInlTQAPtpuc7mlvw3x7pufkzoAaH2P31bHBRsd0ZEJv3IjU+K+U5R1wbdh+gD2WUY 20Wq6Nw7sZkQ== X-IronPort-AV: E=McAfee;i="6200,9189,10024"; a="187132570" X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="187132570" Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2021 03:48:14 -0700 IronPort-SDR: eEghCN/Qvia56WaoGh3LGi+jefvIHH1Kk8fQi7G0evpIAh7cBuF62uih7BxUW5iBA/D+5as8au couLtI9FV+IA== X-IronPort-AV: E=Sophos;i="5.83,296,1616482800"; d="scan'208";a="624148275" Received: from smile.fi.intel.com (HELO smile) ([10.237.68.40]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Jun 2021 03:48:10 -0700 Received: from andy by smile with local (Exim 4.94.2) (envelope-from ) id 1lwMty-004ycA-BM; Thu, 24 Jun 2021 13:48:06 +0300 Date: Thu, 24 Jun 2021 13:48:06 +0300 From: Andy Shevchenko To: Petr Mladek Cc: Jia He , Steven Rostedt , Sergey Senozhatsky , Rasmus Villemoes , Jonathan Corbet , Alexander Viro , Linus Torvalds , "Peter Zijlstra (Intel)" , Eric Biggers , "Ahmed S. Darwish" , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Matthew Wilcox , Christoph Hellwig , nd@arm.com Subject: Re: [PATCH v5 1/4] fs: introduce helper d_path_unsafe() Message-ID: References: <20210622140634.2436-1-justin.he@arm.com> <20210622140634.2436-2-justin.he@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 24, 2021 at 11:26:53AM +0200, Petr Mladek wrote: > On Tue 2021-06-22 17:36:39, Andy Shevchenko wrote: > > On Tue, Jun 22, 2021 at 10:06:31PM +0800, Jia He wrote: > > > This helper is similar to d_path() except that it doesn't take any > > > seqlock/spinlock. It is typical for debugging purposes. Besides, > > > an additional return value *prenpend_len* is used to get the full > > > path length of the dentry, ingoring the tail '\0'. > > > the full path length = end - buf - prepend_length - 1 > > > > Missed period at the end of sentence. > > > > > Previously it will skip the prepend_name() loop at once in > > > __prepen_path() when the buffer length is not enough or even negative. > > > prepend_name_with_len() will get the full length of dentry name > > > together with the parent recursively regardless of the buffer length. > > > > > If someone invokes snprintf() with small but positive space, > > > prepend_name_with_len() moves and copies the string partially. > > > > > > More than that, kasprintf() will pass NULL _buf_ and _end_ as the > > > parameters. Hence return at the very beginning with false in this case. > > > > These two paragraphs are talking about printf() interface, while patch has > > nothing to do with it. Please, rephrase in a way that it doesn't refer to the > > particular callers. Better to mention them in the corresponding printf() > > patch(es). > > The two paragraphs are actually repeated in the 2nd > patch. Unfortunately, they do not make sense there either because they > comment code that is modified in this patch. > > We could describe it here a generic way. For example: > > prepend_name_with_len() moves and copies the path when the given > buffer is not big enough. It cuts off the end of the path. > It returns immediately when there is no buffer at all. Yes, that's my point, but sorry if I made it unclear. -- With Best Regards, Andy Shevchenko