From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from relaydlg-01.paragon-software.com (relaydlg-01.paragon-software.com [81.5.88.159]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 220883FC1 for ; Thu, 2 Sep 2021 16:26:29 +0000 (UTC) Received: from dlg2.mail.paragon-software.com (vdlg-exch-02.paragon-software.com [172.30.1.105]) by relaydlg-01.paragon-software.com (Postfix) with ESMTPS id 229E182139; Thu, 2 Sep 2021 19:26:27 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paragon-software.com; s=mail; t=1630599987; bh=HtXc0ToNMP0KeKMCLl8V8/IXeJ7O/Wq5sp9TlfYLLJk=; h=Subject:To:CC:References:From:Date:In-Reply-To; b=qDMfQwdLcLzXt/gJpxqRsSZwoY7dUkIIayaLpYxfjL/WyNIwC6qjZr4+h5/gwpe+i 23bazWUHcdAfuzuC4Ahj3M21CJIXX+F/nBvdbncB5X0vsKdiN7/Vq73vDt8WYv8ZHB Zo0hrn3MuBB6jIJO0+cjOc7LR+6NTzFZd/90849E= Received: from [192.168.211.59] (192.168.211.59) by vdlg-exch-02.paragon-software.com (172.30.1.105) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 2 Sep 2021 19:26:26 +0300 Subject: Re: [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter To: Kari Argillander , CC: , Dan Carpenter References: <20210825182522.1367594-1-kari.argillander@gmail.com> From: Konstantin Komarov Message-ID: Date: Thu, 2 Sep 2021 19:26:26 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 Precedence: bulk X-Mailing-List: ntfs3@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 In-Reply-To: <20210825182522.1367594-1-kari.argillander@gmail.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [192.168.211.59] X-ClientProxiedBy: vdlg-exch-02.paragon-software.com (172.30.1.105) To vdlg-exch-02.paragon-software.com (172.30.1.105) On 25.08.2021 21:25, Kari Argillander wrote: > This check will be also performed in generic_file_read_iter() so we do > not want to check this two times in a row. > > This was founded with Smatch > fs/ntfs3/file.c:803 ntfs_file_read_iter() > warn: unused return: count = iov_iter_count() > > Signed-off-by: Kari Argillander > --- > I cc Dan also because I am happy that I finally managed to install > Smack and straight away I found something with it. Thank you for > this great tool. > > Next step is to integrate Smack to CI system. But will probanly take > a moment. > --- > fs/ntfs3/file.c | 6 +----- > 1 file changed, 1 insertion(+), 5 deletions(-) > > diff --git a/fs/ntfs3/file.c b/fs/ntfs3/file.c > index cb736701f2cc..5d41b84067ee 100644 > --- a/fs/ntfs3/file.c > +++ b/fs/ntfs3/file.c > @@ -799,8 +799,6 @@ int ntfs3_setattr(struct user_namespace *mnt_userns, struct dentry *dentry, > > static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) > { > - ssize_t err; > - size_t count = iov_iter_count(iter); > struct file *file = iocb->ki_filp; > struct inode *inode = file->f_mapping->host; > struct ntfs_inode *ni = ntfs_i(inode); > @@ -829,9 +827,7 @@ static ssize_t ntfs_file_read_iter(struct kiocb *iocb, struct iov_iter *iter) > return -EOPNOTSUPP; > } > > - err = count ? generic_file_read_iter(iocb, iter) : 0; > - > - return err; > + return generic_file_read_iter(iocb, iter); > } > > /* returns array of locked pages */ > Applied, thanks!