Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1706786pxj; Wed, 19 May 2021 11:59:47 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzW0SPoi7jUCdC3t7jGwbIWVHkgWWgIWkjpAtBVCB9riFcd6ag723Ub605KgveNC6pjmVLL X-Received: by 2002:a17:906:4789:: with SMTP id cw9mr584030ejc.325.1621450787102; Wed, 19 May 2021 11:59:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621450787; cv=none; d=google.com; s=arc-20160816; b=MpyMUON7P39pm9wOV1VhVER4uvSD+oilBfhquDIEp9tHtBQHvlYhetglbaGe2Uu20O nytMnoFAmmwYlGKByeRsDtF6Q7+CwW0fVwIy4ImhfaeDeXrZGIpV9wMTj3HLOm3IUk+8 N6L4o55cG2e3TeIIwCjCrGvItLMmCiKdKA43xPK+oAiz41Ex55MxbVSLOjJgX0zYFf5o Gjo5ITyMDrg04OVXBIxtodcWT6BFg1TUScQhtcrJ4X963qPlkgJ1lh+1JrJTzJrvbmTI PHHpeQqW7AWlLylw6BFQdwR2bDaPuY3PDyIEwItWWBjFgqXBdKeu8IpiRO01SGxh93g2 TG2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=B/PRhwlaWQPUfNSBQyt/n+Gvg2oTe9IGxNXu5iBvuXE=; b=sApHivAsnpvkKKkiJOgDz6GpoD5krPwX4UWFO9b3xNUr7BZfTqr65J+eg6PPD2JdSy MDzhYxiAfwWPIC7DSR+rQxL79xqDJGDy7rz98X/tHxeVh/MimfLV7ZyBa7gFo4sOqdE6 fLDVuRxs0OQAkxYoe3lzOQom2prrG7sG2igEvEGW+xPJcf+UCdkMKiFzrNeQPT13c2RT ld16QkoUUyfz5lfaKctsD32iiZvMjQ47ghgw5LhMzb3fkrBAI+fZz4UIru/6QUDstFfJ T63rssdducbfEAKA23sZf4RbVQgH6D58npePRgt060C1zEke0ZCpVfnAusuKkxtmzBYf /gQA== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ch13si302659ejb.305.2021.05.19.11.59.19; Wed, 19 May 2021 11:59:47 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231371AbhESAxJ (ORCPT + 99 others); Tue, 18 May 2021 20:53:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53960 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233238AbhESAvI (ORCPT ); Tue, 18 May 2021 20:51:08 -0400 Received: from zeniv-ca.linux.org.uk (zeniv-ca.linux.org.uk [IPv6:2607:5300:60:148a::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59FD0C06175F; Tue, 18 May 2021 17:49:49 -0700 (PDT) Received: from viro by zeniv-ca.linux.org.uk with local (Exim 4.94 #2 (Red Hat Linux)) id 1ljAOU-00G4Fs-JV; Wed, 19 May 2021 00:49:02 +0000 From: Al Viro To: Linus Torvalds Cc: Jia He , Petr Mladek , Steven Rostedt , Sergey Senozhatsky , Andy Shevchenko , Rasmus Villemoes , Jonathan Corbet , Heiko Carstens , Vasily Gorbik , Christian Borntraeger , "Eric W . Biederman" , "Darrick J. Wong" , "Peter Zijlstra (Intel)" , Ira Weiny , Eric Biggers , "Ahmed S. Darwish" , "open list:DOCUMENTATION" , Linux Kernel Mailing List , linux-s390 , linux-fsdevel Subject: [PATCH 13/14] d_path: prepend_path() is unlikely to return non-zero Date: Wed, 19 May 2021 00:49:00 +0000 Message-Id: <20210519004901.3829541-13-viro@zeniv.linux.org.uk> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210519004901.3829541-1-viro@zeniv.linux.org.uk> References: <20210519004901.3829541-1-viro@zeniv.linux.org.uk> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: Al Viro Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Signed-off-by: Al Viro --- fs/d_path.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fs/d_path.c b/fs/d_path.c index ba629879a4bf..8a9cd44f6689 100644 --- a/fs/d_path.c +++ b/fs/d_path.c @@ -187,7 +187,7 @@ char *__d_path(const struct path *path, DECLARE_BUFFER(b, buf, buflen); prepend(&b, "", 1); - if (prepend_path(path, root, &b) > 0) + if (unlikely(prepend_path(path, root, &b) > 0)) return NULL; return extract_string(&b); } @@ -199,7 +199,7 @@ char *d_absolute_path(const struct path *path, DECLARE_BUFFER(b, buf, buflen); prepend(&b, "", 1); - if (prepend_path(path, &root, &b) > 1) + if (unlikely(prepend_path(path, &root, &b) > 1)) return ERR_PTR(-EINVAL); return extract_string(&b); } @@ -396,7 +396,7 @@ SYSCALL_DEFINE2(getcwd, char __user *, buf, unsigned long, size) DECLARE_BUFFER(b, page, PATH_MAX); prepend(&b, "", 1); - if (prepend_path(&pwd, &root, &b) > 0) + if (unlikely(prepend_path(&pwd, &root, &b) > 0)) prepend(&b, "(unreachable)", 13); rcu_read_unlock(); -- 2.11.0