From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Joachim Schmitz" Subject: Re: [PATCH v3 1/4] poll() exits too early with EFAULT if 1st arg is NULL Date: Tue, 11 Sep 2012 13:28:47 +0200 Message-ID: References: <003a01cd8cf7$af821100$0e863300$@schmitz-digital.de> Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit To: git@vger.kernel.org X-From: git-owner@vger.kernel.org Tue Sep 11 13:29:17 2012 Return-path: Envelope-to: gcvg-git-2@plane.gmane.org Received: from vger.kernel.org ([209.132.180.67]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TBOeb-0005ir-4J for gcvg-git-2@plane.gmane.org; Tue, 11 Sep 2012 13:29:17 +0200 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758983Ab2IKL3I (ORCPT ); Tue, 11 Sep 2012 07:29:08 -0400 Received: from plane.gmane.org ([80.91.229.3]:34905 "EHLO plane.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758851Ab2IKL3G (ORCPT ); Tue, 11 Sep 2012 07:29:06 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1TBOeR-0005cJ-JU for git@vger.kernel.org; Tue, 11 Sep 2012 13:29:07 +0200 Received: from dsdf-4db532aa.pool.mediaways.net ([77.181.50.170]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Sep 2012 13:29:07 +0200 Received: from jojo by dsdf-4db532aa.pool.mediaways.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 11 Sep 2012 13:29:07 +0200 X-Injected-Via-Gmane: http://gmane.org/ X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: dsdf-4db532aa.pool.mediaways.net X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Sender: git-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: git@vger.kernel.org Archived-At: Joachim Schmitz wrote: > If poll() is used as a milli-second sleep, like in help.c, by passing > a NULL in the 1st and a 0 in the 2nd arg, it exits with EFAULT. > > As per Paolo Bonzini, the original author, this is a bug and to be > fixed like in this commit, which is not to exit if the 2nd arg is 0. > > Signed-off-by: Joachim Schmitz > --- > compat/win32/poll.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/compat/win32/poll.c b/compat/win32/poll.c > index 403eaa7..9e7a25c 100644 > --- a/compat/win32/poll.c > +++ b/compat/win32/poll.c > @@ -349,7 +349,7 @@ poll (struct pollfd *pfd, nfds_t nfd, int timeout) > > /* EFAULT is not necessary to implement, but let's do it in the > simplest case. */ > - if (!pfd) > + if (!pfd && nfd) > { > errno = EFAULT; > return -1; Actually this one is not needed for win32 (nor does win32 suffer from a similar bug), so should probably better get added after patch 2/2 (or as part of it), the move to compat/poll/. Bye, Jojo