Re: [PATCH] fs/eventpoll.c: fix compilation warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Viresh Kumar" <viresh.kumar@xxxxxx> wrote:

>This patch fixes following compilation warning
>fs/eventpoll.c:1119: warning: 'slack' may be used uninitialized in this
>function
>
>Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxx>
>---
> fs/eventpoll.c |    2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
>diff --git a/fs/eventpoll.c b/fs/eventpoll.c
>index 8cf0724..c24a032 100644
>--- a/fs/eventpoll.c
>+++ b/fs/eventpoll.c
>@@ -1116,7 +1116,7 @@ static int ep_poll(struct eventpoll *ep, struct
>epoll_event __user *events,
> {
> 	int res, eavail, timed_out = 0;
> 	unsigned long flags;
>-	long slack;
>+	long slack = 0;
> 	wait_queue_t wait;
> 	struct timespec end_time;
> 	ktime_t expires, *to = NULL;

I don't think this is the correct fix. This function is fine unless timeout is negative.

If a negative timeout is possible then this function will create timer far in the future. I'll leave it up to the maintainer how to solve that one. The two solutions I can see are making timeout unsigned or extending the bottom case of the if to <=0.

Either way we should use uninitalized_var() rather than setting it to zero.

Hope this makes sense,

Jack

-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux