mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bill Rugolsky Jr." <brugolsky@telemetry-investments.com>
To: torvalds@osdl.org, akpm@osdl.org
Cc: linux-kernel@vger.kernel.org, brugolsky@telemetry-investments.com
Subject: [PATCH][2/4] poll()/select() timeout behavior
Date: Fri, 20 Feb 2004 16:02:21 -0500	[thread overview]
Message-ID: <20040220210221.GC1912@ti19.telemetry-investments.com> (raw)

This patch cause select() to return EINVAL when passed an un-normalized
timeval usec, and fixes up the range check in preparation for the patch
that follows.

Please apply.

	Bill Rugolsky

--- linux/fs/select.c	2004-02-20 14:22:53.641191351 -0500
+++ linux/fs/select.c	2004-02-20 14:23:01.891295743 -0500
@@ -291,8 +291,6 @@
  * Update: ERESTARTSYS breaks at least the xview clock binary, so
  * I'm trying ERESTARTNOHAND which restart only when you want to.
  */
-#define MAX_SELECT_SECONDS \
-	((unsigned long) (MAX_SCHEDULE_TIMEOUT / HZ)-1)
 
 asmlinkage long
 sys_select(int n, fd_set __user *inp, fd_set __user *outp, fd_set __user *exp, struct timeval __user *tvp)
@@ -312,10 +310,10 @@
 			goto out_nofds;
 
 		ret = -EINVAL;
-		if (sec < 0 || usec < 0)
+		if (sec < 0 || usec < 0 || usec >= 1000000)
 			goto out_nofds;
 
-		if ((unsigned long) sec < MAX_SELECT_SECONDS) {
+		if ((unsigned long) sec < (MAX_SCHEDULE_TIMEOUT-1) / HZ - 1) {
 			timeout = ROUND_UP(usec, 1000000/HZ);
 			timeout += sec * (unsigned long) HZ;
 		}

             reply	other threads:[~2004-02-20 21:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-20 21:02 Bill Rugolsky Jr. [this message]
2004-02-21  3:58 ` Andrew Morton

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=20040220210221.GC1912@ti19.telemetry-investments.com \
    --to=brugolsky@telemetry-investments.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®