From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.4 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,UNPARSEABLE_RELAY,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 93C39C11F68 for ; Wed, 30 Jun 2021 10:49:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7AD1B6141F for ; Wed, 30 Jun 2021 10:49:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234165AbhF3KwD (ORCPT ); Wed, 30 Jun 2021 06:52:03 -0400 Received: from mx0a-00069f02.pphosted.com ([205.220.165.32]:13006 "EHLO mx0a-00069f02.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229882AbhF3KwD (ORCPT ); Wed, 30 Jun 2021 06:52:03 -0400 Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 15UAfXfd015075; Wed, 30 Jun 2021 10:49:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2020-01-29; bh=FxOE4NuQ35+xxqSaXweYOLfnzgA3aF0LuzxJYhCNSso=; b=HLh2ag2vzSmPWspgoK3yO/X9DaG6syFmljjB68+EcK1q/o0dd0pdEcsxHpSGyIHPadB0 5MgXX3WzwUThrFK/ZX9vd9gyYyKanySv4zpkhlKS+R4RsP5PsfucSvJjafyPvrbesa15 q0Z/N0Y79hhOlOOBb69mMfq+M+Rp6jVMuWLL74GuEHfEYKo191NYZtR8XdV/7/na62wr ZdRd5I81yCPh8o62qSnh6YjBpSW6e3cu7QUz1kwr1MgTDOHQ522DQ8STcMnhKM/XwtgF nbOGKYfv6sHfG/t5TGw1OxuK/0wxWJE9g0GGSkUuZnGUiBC55MVxLYBW8FlcmZwZKMAN /A== Received: from aserp3020.oracle.com (aserp3020.oracle.com [141.146.126.70]) by mx0b-00069f02.pphosted.com with ESMTP id 39gha48pvs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jun 2021 10:49:19 +0000 Received: from pps.filterd (aserp3020.oracle.com [127.0.0.1]) by aserp3020.oracle.com (8.16.0.42/8.16.0.42) with SMTP id 15UAju0p089676; Wed, 30 Jun 2021 10:49:18 GMT Received: from pps.reinject (localhost [127.0.0.1]) by aserp3020.oracle.com with ESMTP id 39dv27q99u-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jun 2021 10:49:18 +0000 Received: from aserp3020.oracle.com (aserp3020.oracle.com [127.0.0.1]) by pps.reinject (8.16.0.36/8.16.0.36) with SMTP id 15UAnHPk098035; Wed, 30 Jun 2021 10:49:17 GMT Received: from aserv0121.oracle.com (aserv0121.oracle.com [141.146.126.235]) by aserp3020.oracle.com with ESMTP id 39dv27q998-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 30 Jun 2021 10:49:17 +0000 Received: from abhmp0004.oracle.com (abhmp0004.oracle.com [141.146.116.10]) by aserv0121.oracle.com (8.14.4/8.14.4) with ESMTP id 15UAnFf1016531; Wed, 30 Jun 2021 10:49:15 GMT Received: from kadam (/102.222.70.252) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Wed, 30 Jun 2021 10:49:14 +0000 Date: Wed, 30 Jun 2021 13:49:04 +0300 From: Dan Carpenter To: Amir Goldstein Cc: kbuild@lists.01.org, Gabriel Krisman Bertazi , kbuild test robot , kbuild-all@lists.01.org, "Darrick J. Wong" , Theodore Tso , Dave Chinner , Jan Kara , David Howells , Khazhismel Kumykov , linux-fsdevel , Ext4 , kernel@collabora.com Subject: Re: [PATCH v3 07/15] fsnotify: pass arguments of fsnotify() in struct fsnotify_event_info Message-ID: <20210630104904.GS2040@kadam> References: <20210629191035.681913-8-krisman@collabora.com> <202106300707.Xg0LaEwy-lkp@intel.com> <20210630084555.GH1983@kadam> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) X-Proofpoint-ORIG-GUID: zTbxK_I6Xemz85vnsMQm6VSaTEbL8JMY X-Proofpoint-GUID: zTbxK_I6Xemz85vnsMQm6VSaTEbL8JMY Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org I think my bug report was not clear... :/ The code looks like this: sb = inode->i_sb; if (inode) ... The NULL check cannot be false because if "inode" is NULL we would have already crashed when we dereference it on the line before. In this case, based on last years discussion, the "inode" pointer can't be NULL. The debate is only whether the unnecessary NULL checks help readability or hurt readability. > Why does it presume that event_info->dir is non-NULL? That was my commentary, just from reading the code. Smatch says that "event->dir" is unknown. > Did smach check all the callers to fsnotify() or something? The kbuild-bot doesn't build the cross function database but if you did use the cross function database then, yes, it does track all the callers. There are two pointers that we care about, the "inode" and the parent inode (dir). Smatch can figure out when "inode" is NULL vs non-NULL but where it gets stuck is on the some of the parent inodes like this call from fsnotify_dirent(): fsnotify_name(dir, mask, d_inode(dentry), &dentry->d_name, 0); ^^^^^^^^^^^^^^^ Smatch doesn't know that d_inode() is always non-NULL at this point. regards, dan carpenter