LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Davide Libenzi <davidel@xmailserver.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	shawn.bohrer@gmail.com, linux-mm@kvack.org,
	linux-fsdevel@vger.kernel.org, mm-commits@vger.kernel.org,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [patch] epoll-fix-compiler-warning-and-optimize-the-non-blocking-path-fix
Date: Wed, 26 Jan 2011 07:05:07 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.00.1101260704050.1889@localhost6.localdomain6> (raw)
In-Reply-To: <20110126102020.GA2244@cmpxchg.org>

On Wed, 26 Jan 2011, Johannes Weiner wrote:

> The non-blocking ep_poll path optimization introduced skipping over
> the return value setup.
> 
> Initialize it properly, my userspace gets upset by epoll_wait()
> returning random things.
> 
> In addition, remove the reinitialization at the fetch_events label,
> the return value is garuanteed to be zero when execution reaches
> there.
> 
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
> Cc: Shawn Bohrer <shawn.bohrer@gmail.com>
> Cc: Davide Libenzi <davidel@xmailserver.org>

Thank you for posting it. Obvious ACK.



> ---
>  fs/eventpoll.c |    3 +--
>  1 files changed, 1 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/eventpoll.c b/fs/eventpoll.c
> index f7cb6cb..afe4238 100644
> --- a/fs/eventpoll.c
> +++ b/fs/eventpoll.c
> @@ -1147,7 +1147,7 @@ static int ep_send_events(struct eventpoll *ep,
>  static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
>  		   int maxevents, long timeout)
>  {
> -	int res, eavail, timed_out = 0;
> +	int res = 0, eavail, timed_out = 0;
>  	unsigned long flags;
>  	long slack = 0;
>  	wait_queue_t wait;
> @@ -1173,7 +1173,6 @@ static int ep_poll(struct eventpoll *ep, struct epoll_event __user *events,
>  fetch_events:
>  	spin_lock_irqsave(&ep->lock, flags);
>  
> -	res = 0;
>  	if (!ep_events_available(ep)) {
>  		/*
>  		 * We don't have any available event to return to the caller.
> -- 
> 1.7.3.5
> 
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@kvack.org.  For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
> Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
> 

  reply	other threads:[~2011-01-26 15:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-01-25 23:48 mmotm 2011-01-25-15-47 uploaded akpm
2011-01-26 10:20 ` [patch] epoll-fix-compiler-warning-and-optimize-the-non-blocking-path-fix Johannes Weiner
2011-01-26 15:05   ` Davide Libenzi [this message]
2011-01-26 19:16 ` [PATCH -mmotm] backlight: apple_bl depends on ACPI Randy Dunlap
2011-01-31 22:31   ` Matthew Garrett
2011-02-03  7:39 ` epoll broken [was: mmotm 2011-01-25-15-47 uploaded] Jiri Slaby
2011-02-03  7:53   ` Eric Dumazet
2011-02-03  9:03     ` Jiri Slaby

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1101260704050.1889@localhost6.localdomain6 \
    --to=davidel@xmailserver.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mm-commits@vger.kernel.org \
    --cc=shawn.bohrer@gmail.com \
    --subject='Re: [patch] epoll-fix-compiler-warning-and-optimize-the-non-blocking-path-fix' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).