From patchwork Fri Sep 29 09:12:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luis Henriques X-Patchwork-Id: 146740 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:6359:6f87:b0:13f:353d:d1ed with SMTP id tl7csp3520709rwb; Fri, 29 Sep 2023 12:38:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFs6HsL46VXjd4iEHgWeBOqZ2m8mFUreiaXvnhS2wsmOceXWsnt4NgXfn3Q0E+BxMYLNC+d X-Received: by 2002:a05:6a21:32a6:b0:15d:8eea:27a3 with SMTP id yt38-20020a056a2132a600b0015d8eea27a3mr8592209pzb.3.1696016334811; Fri, 29 Sep 2023 12:38:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696016334; cv=none; d=google.com; s=arc-20160816; b=J0h/4fpsOmlKTkW9mIX4/8EnP6uav6Zf2ABrTqcQ7KqNbFajOgSOW2IqachC7yysD1 57XJiMM8prXB3Xmedso0IY4JoUitMcUT7WxOp9hV1Nl+7tJSPOKIweQqG4/I5rz8BywM JjYkdiNTc51UB9SygFxICdN4NG14gLFlVwRkTfeybrP5mJICpgXdEnOEzC9ZjCbVWaC9 yAmEzzsgRAQN8+X4uvhQMhNrJpKN10QSbJqSt7xaQzdt4l810Vbko9bVaR4xtk4CDmOY d5PuaHvkEoKF3tyqR/By0yXazLY/TrnsE3poNTsiDOtAF/YhXc8gWLV5S09kwwcJOV6Z pu6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature:dkim-signature; bh=y6Yspn96ID1Nu2kmrOikYfZO30eu8cRjXf4zvZ40V9A=; fh=PgPHAKoklJEvX/h6dO0WI3GeVJlTahdq4X8To9w/+2I=; b=kQbrzsMsrwejjOaRoC0YZEyd8YmGlOeCH7MGiYXz0y4EGdKb+T3vKwSQAyAWCM2AXp 3IbIdTU6o23FuuKkzetVpPhVcXbXe0sJviPVFHgmYO+CAY7HH4lfI58ZqG915j/5Gify T1SgXOXkz6JJBYD+1wmWzZ56l9HYTgOnqXzksma69djVGdh385glqfaqo+7kK7gzrBCh aeKDlotLnduLREtYz7fI6w3O8rei0+RxT9dUHCbBpuWv5fbYBC+ik556FdxpYgevQl7e djRQor/EdEvQCU7ehXYYE2XnC/Uvglb/75mPf46qAc0BdYwOTK92LWQ9wzyyDP3S2iQO JE3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SY4tzRLM; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id ck12-20020a056a00328c00b00690ff5e479fsi21051138pfb.332.2023.09.29.12.38.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Sep 2023 12:38:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=SY4tzRLM; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 38C2E80622A4; Fri, 29 Sep 2023 02:12:23 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232876AbjI2JMN (ORCPT + 20 others); Fri, 29 Sep 2023 05:12:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232871AbjI2JML (ORCPT ); Fri, 29 Sep 2023 05:12:11 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF12811F; Fri, 29 Sep 2023 02:12:09 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 7ABF4210E3; Fri, 29 Sep 2023 09:12:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1695978728; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y6Yspn96ID1Nu2kmrOikYfZO30eu8cRjXf4zvZ40V9A=; b=SY4tzRLMcYXa/Zj0Fb1x4yDe/UtynljGrYZuUR6FLPEAVL8JVLgJ229RAG7TAkqsEJ7eHE wqHf0BaE/SQihaHhIVovvrrz4b3FOh0W00DFoh/xkWLk9VRoABV9/WbEeo9g88mWcaxIKP FuFkvozSIbVNAOO9hWo0Qwb/BnO24tI= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1695978728; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding; bh=y6Yspn96ID1Nu2kmrOikYfZO30eu8cRjXf4zvZ40V9A=; b=9B25+CKUeLE5qpy1n9LJlMrd8lpPOene7NLQkGKbmn6Eh32s28kOHFvPE9AiMGvKw7o3i3 LJ7ysBqATiNvF8Bw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id EAC1813434; Fri, 29 Sep 2023 09:12:07 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id DOv5NeeUFmXxAQAAMHmgww (envelope-from ); Fri, 29 Sep 2023 09:12:07 +0000 Received: from localhost (brahms.olymp [local]) by brahms.olymp (OpenSMTPD) with ESMTPA id ec8c4358; Fri, 29 Sep 2023 09:12:07 +0000 (UTC) From: Luis Henriques To: Xiubo Li , Ilya Dryomov , Jeff Layton Cc: ceph-devel@vger.kernel.org, linux-kernel@vger.kernel.org, Luis Henriques , kernel test robot , Dan Carpenter Subject: [PATCH] ceph: remove unnecessary IS_ERR() check in ceph_fname_to_usr() Date: Fri, 29 Sep 2023 10:12:06 +0100 Message-Id: <20230929091206.13955-1-lhenriques@suse.de> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Fri, 29 Sep 2023 02:12:23 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778402023904734149 X-GMAIL-MSGID: 1778402023904734149 Before returning, function ceph_fname_to_usr() does a final IS_ERR() check in 'dir': if ((dir != fname->dir) && !IS_ERR(dir)) {...} This check is unnecessary because, if the 'dir' variable has changed to something other than 'fname->dir' (it's initial value), that error check has been performed already and, if there was indeed an error, it would have been returned immediately. Besides, this useless IS_ERR() is also confusing static analysis tools. Reported-by: kernel test robot Reported-by: Dan Carpenter Closes: https://lore.kernel.org/r/202309282202.xZxGdvS3-lkp@intel.com/ Signed-off-by: Luis Henriques --- fs/ceph/crypto.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ceph/crypto.c b/fs/ceph/crypto.c index e4d5cd56a80b..e19019209cf0 100644 --- a/fs/ceph/crypto.c +++ b/fs/ceph/crypto.c @@ -462,7 +462,7 @@ int ceph_fname_to_usr(const struct ceph_fname *fname, struct fscrypt_str *tname, out: fscrypt_fname_free_buffer(&_tname); out_inode: - if ((dir != fname->dir) && !IS_ERR(dir)) { + if (dir != fname->dir) { if ((dir->i_state & I_NEW)) discard_new_inode(dir); else