Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp700187rwb; Mon, 26 Sep 2022 04:56:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6agwYt02zfxJ0mIvqvEI1eFrJIVZPZv/Q+/rX1jO9JudGmeufX2Xlt7EF2+QN2WIHWM+/i X-Received: by 2002:a17:902:b7c5:b0:178:a207:d789 with SMTP id v5-20020a170902b7c500b00178a207d789mr21568630plz.70.1664193419367; Mon, 26 Sep 2022 04:56:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664193419; cv=none; d=google.com; s=arc-20160816; b=W50NeG0xC7NZvuLDzNb0CDmEMOEDvLYjSZ41syu7n9L2o+KU0IpkZ0vGroE7UyXhWJ Y1f+R2Xtj1xt0lKaBfY/EKpG8FfMqfcVfPCSiq980LGjrIDQepgHKvP+gqKb9X7EdCX4 KyJT8LCPnu/DYWzkbdH1DAQXMH7f2+PQ2Sb9nB2kfjCe8JvtcuC9Ppkv3QHPihxT1OH0 JdTB0FXSZHfh/l+HDDv0VWbB5aGb+RpmHfgdPDsDFyAW+v2lKeEnNO7n0PVi/l1SmlI0 trxJkQo6PR5REwM5iJ9lRHb6wQVq1rqTySjDaLv8/eRIMcLVrxuS+O+pLB5LT/+ZyZWs SiCA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=qyn+uAcZdiRebtAUCF8PAKzbg0m2CKQSW9gtgPhpHE8=; b=jcRUyF1bH/WWurmckR0Mw5EoZ6ie+/lGokLLoRNR5ix+m+wSRCR8vp5trT/OC+D5A2 EVqb2r1jJkKT3+ypIIyKvyjIoqn90szr6sBSydKFb1CtXYChcPWeq43MX1wgeJcKXSAp w2ohGlVlpuoIuKvcyR2B33pcCQIEbU2LqqnkfmORunat1B3AwbS9n1Pu3WNSCbE18wkg 0oNnCPgbcAUpa3YzxiHNCbXZPf5qjYj1qv3USQccdR5iQESR5CdEADdtonuARTK33sK8 2WnEkZG16JLyMEJR77KOlWmHtSXvPlq9atqWGSleYP1RFLn5e07X7aSFYjyW6hNQ/BDj fwJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=f27C6uB+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mq12-20020a17090b380c00b00200919a55b1si13336266pjb.180.2022.09.26.04.56.47; Mon, 26 Sep 2022 04:56:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@digikod.net header.s=20191114 header.b=f27C6uB+; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236323AbiIZLlS (ORCPT + 99 others); Mon, 26 Sep 2022 07:41:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238217AbiIZLks (ORCPT ); Mon, 26 Sep 2022 07:40:48 -0400 Received: from smtp-1908.mail.infomaniak.ch (smtp-1908.mail.infomaniak.ch [185.125.25.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FCA65280E for ; Mon, 26 Sep 2022 03:45:15 -0700 (PDT) Received: from smtp-3-0000.mail.infomaniak.ch (unknown [10.4.36.107]) by smtp-3-3000.mail.infomaniak.ch (Postfix) with ESMTPS id 4MbfWw08WqzMqLsX; Mon, 26 Sep 2022 12:44:28 +0200 (CEST) Received: from ns3096276.ip-94-23-54.eu (unknown [23.97.221.149]) by smtp-3-0000.mail.infomaniak.ch (Postfix) with ESMTPA id 4MbfWv15PqzxK; Mon, 26 Sep 2022 12:44:27 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=digikod.net; s=20191114; t=1664189067; bh=CD5C6xTOGWbxduJpk36+aJl7noaWIOhUL8dP/2UeQ/U=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=f27C6uB+afTbOUHgc9hxBrFbzQZ/LtcH1vjNZiWc+OJq6D9yVYBIXLKKgpP9J8vgQ 13dDbjoqZAYZz7mYDopFn355SCegOCr4rT1UBidp+4sHkHSL0ULdzXO9mC399Wi1lM l2Zz9rpF6JYX17RARkGQ6PNrcGR/mAYzayF6pCsM= Message-ID: <0280dfc4-1497-280a-f0cc-c2867227219b@digikod.net> Date: Mon, 26 Sep 2022 12:44:26 +0200 MIME-Version: 1.0 User-Agent: Subject: Re: [PATCH] landlock: Remove unnecessary conditionals Content-Language: en-US To: Jingyu Wang , paul@paul-moore.com, jmorris@namei.org, serge@hallyn.com Cc: linux-security-module@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220908190239.76888-1-jingyuwang_vip@163.com> From: =?UTF-8?Q?Micka=c3=abl_Sala=c3=bcn?= In-Reply-To: <20220908190239.76888-1-jingyuwang_vip@163.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2,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 Thanks for the review. I agree that this condition is optional but it makes the code less error prone, more consistent, easier to read, and avoids jumping to an external function. I then don't think this minor change is worth it. On 08/09/2022 21:02, Jingyu Wang wrote: > iput() has already handled null and non-null parameter, so it is no > need to use if(). > > Signed-off-by: Jingyu Wang > --- > security/landlock/fs.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/security/landlock/fs.c b/security/landlock/fs.c > index 6121e9834961..3d0a8a418ce4 100644 > --- a/security/landlock/fs.c > +++ b/security/landlock/fs.c > @@ -1009,8 +1009,7 @@ static void hook_sb_delete(struct super_block *const sb) > spin_unlock(&sb->s_inode_list_lock); > > /* Puts the inode reference from the last loop walk, if any. */ > - if (prev_inode) > - iput(prev_inode); > + iput(prev_inode); > /* Waits for pending iput() in release_inode(). */ > wait_var_event(&landlock_superblock(sb)->inode_refs, > !atomic_long_read(&landlock_superblock(sb)->inode_refs)); > > base-commit: 5957ac6635a1a12d4aa2661bbf04d3085a73372a