diff options
| -rw-r--r-- | arch/parisc/kernel/time.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/arch/parisc/kernel/time.c b/arch/parisc/kernel/time.c index 594930bc4bcf..eb35e1c0bb53 100644 --- a/arch/parisc/kernel/time.c +++ b/arch/parisc/kernel/time.c | |||
| @@ -157,8 +157,22 @@ do_gettimeofday (struct timeval *tv) | |||
| 157 | usec += (xtime.tv_nsec / 1000); | 157 | usec += (xtime.tv_nsec / 1000); |
| 158 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); | 158 | } while (read_seqretry_irqrestore(&xtime_lock, seq, flags)); |
| 159 | 159 | ||
| 160 | while (usec >= 1000000) { | 160 | if (unlikely(usec > LONG_MAX)) { |
| 161 | usec -= 1000000; | 161 | /* This can happen if the gettimeoffset adjustment is |
| 162 | * negative and xtime.tv_nsec is smaller than the | ||
| 163 | * adjustment */ | ||
| 164 | printk(KERN_ERR "do_gettimeofday() spurious xtime.tv_nsec of %ld\n", usec); | ||
| 165 | usec += USEC_PER_SEC; | ||
| 166 | --sec; | ||
| 167 | /* This should never happen, it means the negative | ||
| 168 | * time adjustment was more than a second, so there's | ||
| 169 | * something seriously wrong */ | ||
| 170 | BUG_ON(usec > LONG_MAX); | ||
| 171 | } | ||
| 172 | |||
| 173 | |||
| 174 | while (usec >= USEC_PER_SEC) { | ||
| 175 | usec -= USEC_PER_SEC; | ||
| 162 | ++sec; | 176 | ++sec; |
| 163 | } | 177 | } |
| 164 | 178 | ||
