* [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter
@ 2021-08-25 18:25 Kari Argillander
2021-08-25 19:17 ` Dan Carpenter
2021-09-02 16:26 ` Konstantin Komarov
0 siblings, 2 replies; 4+ messages in thread
From: Kari Argillander @ 2021-08-25 18:25 UTC (permalink / raw)
To: Konstantin Komarov, ntfs3; +Cc: Kari Argillander, linux-kernel, Dan Carpenter
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 <kari.argillander@gmail.com>
---
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 */
--
2.30.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter
2021-08-25 18:25 [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter Kari Argillander
@ 2021-08-25 19:17 ` Dan Carpenter
2021-08-25 19:31 ` Kari Argillander
2021-09-02 16:26 ` Konstantin Komarov
1 sibling, 1 reply; 4+ messages in thread
From: Dan Carpenter @ 2021-08-25 19:17 UTC (permalink / raw)
To: Kari Argillander; +Cc: Konstantin Komarov, ntfs3, linux-kernel
On Wed, Aug 25, 2021 at 09:25:22PM +0300, 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 <kari.argillander@gmail.com>
> ---
> 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.
Thanks!
You got a bit lucky, because you're using the --two-passes and the truth
is I haven't looked at that in years so I'm worried it's probably not
great. You probably be better off not using the --two-passes option. :/
I should remove it.
regards,
dan carpenter
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter
2021-08-25 19:17 ` Dan Carpenter
@ 2021-08-25 19:31 ` Kari Argillander
0 siblings, 0 replies; 4+ messages in thread
From: Kari Argillander @ 2021-08-25 19:31 UTC (permalink / raw)
To: Dan Carpenter; +Cc: Konstantin Komarov, ntfs3, linux-kernel
On Wed, Aug 25, 2021 at 10:17:57PM +0300, Dan Carpenter wrote:
> On Wed, Aug 25, 2021 at 09:25:22PM +0300, 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 <kari.argillander@gmail.com>
> > ---
> > 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.
>
> Thanks!
>
> You got a bit lucky, because you're using the --two-passes and the truth
> is I haven't looked at that in years so I'm worried it's probably not
> great. You probably be better off not using the --two-passes option. :/
> I should remove it.
Haha no I need it :D I was just testing what this tool can do. I also
notice that --two-passes seems quite bad to read. But hey I found
something! :D Good to know that you are not using it. I will not use it
then. Thanks.
>
> regards,
> dan carpenter
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter
2021-08-25 18:25 [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter Kari Argillander
2021-08-25 19:17 ` Dan Carpenter
@ 2021-09-02 16:26 ` Konstantin Komarov
1 sibling, 0 replies; 4+ messages in thread
From: Konstantin Komarov @ 2021-09-02 16:26 UTC (permalink / raw)
To: Kari Argillander, ntfs3; +Cc: linux-kernel, Dan Carpenter
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 <kari.argillander@gmail.com>
> ---
> 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!
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-09-02 16:26 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-25 18:25 [PATCH] fs/ntfs3: Remove unnecessary condition checking from ntfs_file_read_iter Kari Argillander
2021-08-25 19:17 ` Dan Carpenter
2021-08-25 19:31 ` Kari Argillander
2021-09-02 16:26 ` Konstantin Komarov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).