Check shift used in freq_est and stats max_count calculation.
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>master
parent
7d8f31da45
commit
c547145834
8
clock.c
8
clock.c
|
@ -999,11 +999,19 @@ void clock_sync_interval(struct clock *c, int n)
|
||||||
shift = c->freq_est_interval - n;
|
shift = c->freq_est_interval - n;
|
||||||
if (shift < 0)
|
if (shift < 0)
|
||||||
shift = 0;
|
shift = 0;
|
||||||
|
else if (shift >= sizeof(int) * 8) {
|
||||||
|
shift = sizeof(int) * 8 - 1;
|
||||||
|
pr_warning("freq_est_interval is too long");
|
||||||
|
}
|
||||||
c->fest.max_count = (1 << shift);
|
c->fest.max_count = (1 << shift);
|
||||||
|
|
||||||
shift = c->stats_interval - n;
|
shift = c->stats_interval - n;
|
||||||
if (shift < 0)
|
if (shift < 0)
|
||||||
shift = 0;
|
shift = 0;
|
||||||
|
else if (shift >= sizeof(int) * 8) {
|
||||||
|
shift = sizeof(int) * 8 - 1;
|
||||||
|
pr_warning("summary_interval is too long");
|
||||||
|
}
|
||||||
c->stats.max_count = (1 << shift);
|
c->stats.max_count = (1 << shift);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
4
port.c
4
port.c
|
@ -551,6 +551,10 @@ static void port_nrate_initialize(struct port *p)
|
||||||
|
|
||||||
if (shift < 0)
|
if (shift < 0)
|
||||||
shift = 0;
|
shift = 0;
|
||||||
|
else if (shift >= sizeof(int) * 8) {
|
||||||
|
shift = sizeof(int) * 8 - 1;
|
||||||
|
pr_warning("freq_est_interval is too long");
|
||||||
|
}
|
||||||
|
|
||||||
/* We start in the 'incapable' state. */
|
/* We start in the 'incapable' state. */
|
||||||
p->pdr_missing = ALLOWED_LOST_RESPONSES + 1;
|
p->pdr_missing = ALLOWED_LOST_RESPONSES + 1;
|
||||||
|
|
Loading…
Reference in New Issue