diff options
| author | Jan Engelmohr <jan.engelmohr@mailbox.tu-dresden.de> | 2016-07-26 18:10:00 +0200 |
|---|---|---|
| committer | Moyster <oysterized@gmail.com> | 2016-08-26 15:59:39 +0200 |
| commit | d2ee3e254ee0939806c103c145035ddac9fe5953 (patch) | |
| tree | 2fc8a4984c6cec24591bb68f3e0623bd1c1d45fc /kernel/time | |
| parent | a2904e3eed56216fe65091d9b3638ae1f90e43fa (diff) | |
3.10.70 -> 3.10.71
Diffstat (limited to 'kernel/time')
| -rw-r--r-- | kernel/time/ntp.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/kernel/time/ntp.c b/kernel/time/ntp.c index 28db9bedc..6211d5d6d 100644 --- a/kernel/time/ntp.c +++ b/kernel/time/ntp.c @@ -631,10 +631,14 @@ int ntp_validate_timex(struct timex *txc) if ((txc->modes & ADJ_SETOFFSET) && (!capable(CAP_SYS_TIME))) return -EPERM; - if (txc->modes & ADJ_FREQUENCY) { - if (LONG_MIN / PPM_SCALE > txc->freq) + /* + * Check for potential multiplication overflows that can + * only happen on 64-bit systems: + */ + if ((txc->modes & ADJ_FREQUENCY) && (BITS_PER_LONG == 64)) { + if (LLONG_MIN / PPM_SCALE > txc->freq) return -EINVAL; - if (LONG_MAX / PPM_SCALE < txc->freq) + if (LLONG_MAX / PPM_SCALE < txc->freq) return -EINVAL; } |
