aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/select.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/fs/select.c b/fs/select.c
index 9c4f0f2604f1..33b72ba0f86f 100644
--- a/fs/select.c
+++ b/fs/select.c
@@ -746,9 +746,9 @@ out_fds:
746asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds, 746asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
747 long timeout_msecs) 747 long timeout_msecs)
748{ 748{
749 s64 timeout_jiffies = 0; 749 s64 timeout_jiffies;
750 750
751 if (timeout_msecs) { 751 if (timeout_msecs > 0) {
752#if HZ > 1000 752#if HZ > 1000
753 /* We can only overflow if HZ > 1000 */ 753 /* We can only overflow if HZ > 1000 */
754 if (timeout_msecs / 1000 > (s64)0x7fffffffffffffffULL / (s64)HZ) 754 if (timeout_msecs / 1000 > (s64)0x7fffffffffffffffULL / (s64)HZ)
@@ -756,6 +756,9 @@ asmlinkage long sys_poll(struct pollfd __user *ufds, unsigned int nfds,
756 else 756 else
757#endif 757#endif
758 timeout_jiffies = msecs_to_jiffies(timeout_msecs); 758 timeout_jiffies = msecs_to_jiffies(timeout_msecs);
759 } else {
760 /* Infinite (< 0) or no (0) timeout */
761 timeout_jiffies = timeout_msecs;
759 } 762 }
760 763
761 return do_sys_poll(ufds, nfds, &timeout_jiffies); 764 return do_sys_poll(ufds, nfds, &timeout_jiffies);