Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp48370pxv; Thu, 24 Jun 2021 02:28:37 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1mfMZApuDhPybdCyotGbM8UsA2V/zGo60krC0tct0FXEgeHTVkrihf8GyQL83J0Mpq21Y X-Received: by 2002:aa7:dad5:: with SMTP id x21mr5796569eds.280.1624526917204; Thu, 24 Jun 2021 02:28:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1624526917; cv=none; d=google.com; s=arc-20160816; b=iTihbvH3HyTLNrKG8NOY9NuqgH7WcZVOHhEGLDcuG4Q4DDYbQY7cKyMtfYlkraT6OG PlmoPRRaBfM3AgA5dS4HxXZWM7q26VysOXy8tuZ1gwJ7yQNRMSNhqNgso0u+biXgz6a7 g5pGGWS43xDq1I/Nw1BxPlkD44Tm5s9/6cr+NaU/Lb/yBn0gSdCovEu1SmylmEaJZtSg QZBm7a66AIcMjH6fdGD7MfSnwrUKqiyZZUD/fNi7H+6LtgbT2SVrTOntP6b68XRrsWLD dBCoUldYVi+ha9xPKXmpNiJ0NNJLBYuAuv8sjZORg9Kz2Fv1rkBJfJqXcUcKAkMBHS1w slgA== 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=RZyOP0C7F0XqPPPuvo2PjV5DVfUtOrFQsZ8R5CvApEg=; b=xP8FggkIhgZmns79t/7c73gJ0IC755NEpOUdBYB5ENOEr4ngEDDFwSdnYNajS1uWLU xOybuUmmgsCJ7C/II/0WIxzKyvqAj9wEW4AXRgAhqqRi6y3lw0Sdo/7I4VD0ZS2lu4NG lJeqdzbmqxxC0e/O44cVvTC+0i99VKU8fjki6IyX2FacOOrh38gdL4oWWMrRQBRVQdOl D35v6C/52uKwYVq6cMIyaBhlhjOUmsLqogwJiu/KrZ8wUD4HLrPRkoxoRx1D/2JltSF+ nmB7Z2nZlT9Dakz7/yMGGNp9lkV/LjV0QMXWE2rqfX/MTrR8ljMDk3MI0m37jKhxbWCj 2Duw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=puUrylTG; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i17si2770214edb.326.2021.06.24.02.28.14; Thu, 24 Jun 2021 02:28:37 -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; dkim=pass header.i=@suse.com header.s=susede1 header.b=puUrylTG; 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=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231895AbhFXJ3O (ORCPT + 99 others); Thu, 24 Jun 2021 05:29:14 -0400 Received: from smtp-out2.suse.de ([195.135.220.29]:59470 "EHLO smtp-out2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230274AbhFXJ3N (ORCPT ); Thu, 24 Jun 2021 05:29:13 -0400 Received: from relay2.suse.de (relay2.suse.de [149.44.160.134]) by smtp-out2.suse.de (Postfix) with ESMTP id 0E5B11FD67; Thu, 24 Jun 2021 09:26:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1624526814; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=RZyOP0C7F0XqPPPuvo2PjV5DVfUtOrFQsZ8R5CvApEg=; b=puUrylTGuwUK7U4t0meYfv/ls3Jneaz2guT1qMpP+itr7K9jYXbAFn6iv4Dfa4b24elcdf IKsOWMI1MPmcJsbaSit3TTUjwaldXaBlugSgATzAe41izPH8iRFB4wxWdgD+caLPj2w4UZ QG0p3exnzUZXxtnWgxyqq+qIfCyjadg= Received: from suse.cz (unknown [10.100.224.162]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by relay2.suse.de (Postfix) with ESMTPS id 2EAA6A3BC5; Thu, 24 Jun 2021 09:26:51 +0000 (UTC) Date: Thu, 24 Jun 2021 11:26:53 +0200 From: Petr Mladek To: Andy Shevchenko 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: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Best Regards, Petr