* [PATCH] fanotify: remove always false comparison in copy_fid_to_user
@ 2019-09-03 1:54 zhengbin
2019-09-03 11:28 ` Matthew Wilcox
2019-09-03 11:40 ` Jan Kara
0 siblings, 2 replies; 4+ messages in thread
From: zhengbin @ 2019-09-03 1:54 UTC (permalink / raw)
To: amir73il, jack, linux-fsdevel; +Cc: zhengbin13
Fixes gcc warning:
fs/notify/fanotify/fanotify_user.c:252:19: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: zhengbin <zhengbin13@huawei.com>
---
fs/notify/fanotify/fanotify_user.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
index 8508ab5..e15547d 100644
--- a/fs/notify/fanotify/fanotify_user.c
+++ b/fs/notify/fanotify/fanotify_user.c
@@ -249,7 +249,7 @@ static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)
/* Pad with 0's */
buf += fh_len;
len -= fh_len;
- WARN_ON_ONCE(len < 0 || len >= FANOTIFY_EVENT_ALIGN);
+ WARN_ON_ONCE(len >= FANOTIFY_EVENT_ALIGN);
if (len > 0 && clear_user(buf, len))
return -EFAULT;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] fanotify: remove always false comparison in copy_fid_to_user
2019-09-03 1:54 [PATCH] fanotify: remove always false comparison in copy_fid_to_user zhengbin
@ 2019-09-03 11:28 ` Matthew Wilcox
2019-09-03 20:10 ` Jan Kara
2019-09-03 11:40 ` Jan Kara
1 sibling, 1 reply; 4+ messages in thread
From: Matthew Wilcox @ 2019-09-03 11:28 UTC (permalink / raw)
To: zhengbin; +Cc: amir73il, jack, linux-fsdevel
On Tue, Sep 03, 2019 at 09:54:14AM +0800, zhengbin wrote:
> Fixes gcc warning:
>
> fs/notify/fanotify/fanotify_user.c:252:19: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
When fixing bugs like this, please do a git log -p and cc the person
responsible for introducing the code you're fixing. Also add a Fixes:
line.
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fanotify: remove always false comparison in copy_fid_to_user
2019-09-03 1:54 [PATCH] fanotify: remove always false comparison in copy_fid_to_user zhengbin
2019-09-03 11:28 ` Matthew Wilcox
@ 2019-09-03 11:40 ` Jan Kara
1 sibling, 0 replies; 4+ messages in thread
From: Jan Kara @ 2019-09-03 11:40 UTC (permalink / raw)
To: zhengbin; +Cc: amir73il, jack, linux-fsdevel
On Tue 03-09-19 09:54:14, zhengbin wrote:
> Fixes gcc warning:
>
> fs/notify/fanotify/fanotify_user.c:252:19: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
>
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: zhengbin <zhengbin13@huawei.com>
Thanks for the patch! I've added it to my tree.
Honza
> ---
> fs/notify/fanotify/fanotify_user.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/fs/notify/fanotify/fanotify_user.c b/fs/notify/fanotify/fanotify_user.c
> index 8508ab5..e15547d 100644
> --- a/fs/notify/fanotify/fanotify_user.c
> +++ b/fs/notify/fanotify/fanotify_user.c
> @@ -249,7 +249,7 @@ static int copy_fid_to_user(struct fanotify_event *event, char __user *buf)
> /* Pad with 0's */
> buf += fh_len;
> len -= fh_len;
> - WARN_ON_ONCE(len < 0 || len >= FANOTIFY_EVENT_ALIGN);
> + WARN_ON_ONCE(len >= FANOTIFY_EVENT_ALIGN);
> if (len > 0 && clear_user(buf, len))
> return -EFAULT;
>
> --
> 2.7.4
>
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] fanotify: remove always false comparison in copy_fid_to_user
2019-09-03 11:28 ` Matthew Wilcox
@ 2019-09-03 20:10 ` Jan Kara
0 siblings, 0 replies; 4+ messages in thread
From: Jan Kara @ 2019-09-03 20:10 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: zhengbin, amir73il, jack, linux-fsdevel
On Tue 03-09-19 04:28:21, Matthew Wilcox wrote:
> On Tue, Sep 03, 2019 at 09:54:14AM +0800, zhengbin wrote:
> > Fixes gcc warning:
> >
> > fs/notify/fanotify/fanotify_user.c:252:19: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits]
> >
> > Reported-by: Hulk Robot <hulkci@huawei.com>
> > Signed-off-by: zhengbin <zhengbin13@huawei.com>
>
> When fixing bugs like this, please do a git log -p and cc the person
> responsible for introducing the code you're fixing. Also add a Fixes:
> line.
Generally I agree although in this particular case it is just a cosmetic
fix so I don't find that very important.
> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Thanks for review!
Honza
--
Jan Kara <jack@suse.com>
SUSE Labs, CR
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-03 20:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 1:54 [PATCH] fanotify: remove always false comparison in copy_fid_to_user zhengbin
2019-09-03 11:28 ` Matthew Wilcox
2019-09-03 20:10 ` Jan Kara
2019-09-03 11:40 ` Jan Kara
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).