All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Luís Henriques" <lhenriques@suse.de>
To: Xiubo Li <xiubli@redhat.com>
Cc: Ilya Dryomov <idryomov@gmail.com>,
	Jeff Layton <jlayton@kernel.org>,
	Milind Changire <mchangir@redhat.com>,
	ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org,
	Dan Carpenter <dan.carpenter@linaro.org>
Subject: Re: [PATCH] ceph: remove unnecessary check for NULL in parse_longname()
Date: Fri, 08 Sep 2023 09:39:29 +0100	[thread overview]
Message-ID: <877cp1m532.fsf@suse.de> (raw)
In-Reply-To: <3493bd1b-4982-e851-a2bc-c806889af01e@redhat.com> (Xiubo Li's message of "Fri, 8 Sep 2023 08:14:19 +0800")

Xiubo Li <xiubli@redhat.com> writes:

> On 9/7/23 21:39, Luís Henriques wrote:
>> Function ceph_get_inode() never returns NULL; instead it returns an
>> ERR_PTR() if something fails.  Thus, the check for NULL in
>> parse_longname() useless and can be dropped.
>>
>> Fixes: dd66df0053ef ("ceph: add support for encrypted snapshot names")
>> Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>> Signed-off-by: Luís Henriques <lhenriques@suse.de>
>> ---
>>   fs/ceph/crypto.c | 2 --
>>   1 file changed, 2 deletions(-)
>>
>> diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c
>> index e4d5cd56a80b..7d0b9b5ccfc6 100644
>> --- a/fs/ceph/crypto.c
>> +++ b/fs/ceph/crypto.c
>> @@ -249,8 +249,6 @@ static struct inode *parse_longname(const struct inode *parent,
>>   	if (!dir) {
>>   		/* This can happen if we're not mounting cephfs on the root */
>>   		dir = ceph_get_inode(parent->i_sb, vino, NULL);
>> -		if (!dir)
>> -			dir = ERR_PTR(-ENOENT);
>>   	}
>>   	if (IS_ERR(dir))
>>   		dout("Can't find inode %s (%s)\n", inode_number, name);
>>
> Luis,
>
> How about moving the error check into the  'if (!dir) {}' ? Because from
> 'ceph_find_inode()' the return value shouldn't be true here. This err check
> should for 'ceph_get_inode()' only.

Yeah, you're right.  Thanks, Xiubo.  I'll send out v2 shortly.

Cheers,
-- 
Luís

      reply	other threads:[~2023-09-08  8:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-07 13:39 [PATCH] ceph: remove unnecessary check for NULL in parse_longname() Luís Henriques
2023-09-08  0:14 ` Xiubo Li
2023-09-08  8:39   ` Luís Henriques [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877cp1m532.fsf@suse.de \
    --to=lhenriques@suse.de \
    --cc=ceph-devel@vger.kernel.org \
    --cc=dan.carpenter@linaro.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchangir@redhat.com \
    --cc=xiubli@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.