[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] qemu_timer_pending/qemu_get_timer: cope with NULL timers
On Mon, 2011-12-05 at 10:54 +0000, Stefano Stabellini wrote: > qemu_timer_pending and qemu_get_timer: don't crash if the timer passed > as an argument is NULL. It would have been useful to mention why a NULL timer is valid here. Apart from just being good changelog practice to explain the actual reason for a change this would also help tell us why this issue isn't being solved further up the stack. One the face of it this seem like this ought to be a bug in the caller of qemu_mod_timer. Ian. > > Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx> > > diff --git a/vl.c b/vl.c > index f07a659..f3b3d02 100644 > --- a/vl.c > +++ b/vl.c > @@ -1201,6 +1201,10 @@ void qemu_mod_timer(QEMUTimer *ts, int64_t expire_time) > int qemu_timer_pending(QEMUTimer *ts) > { > QEMUTimer *t; > + > + if (ts == NULL) > + return 0; > + > for(t = active_timers[ts->clock->type]; t != NULL; t = t->next) { > if (t == ts) > return 1; > @@ -1272,6 +1276,9 @@ void qemu_get_timer(QEMUFile *f, QEMUTimer *ts) > { > uint64_t expire_time; > > + if (ts == NULL) > + return; > + > expire_time = qemu_get_be64(f); > if (expire_time != -1) { > qemu_mod_timer(ts, expire_time); > > _______________________________________________ > Xen-devel mailing list > Xen-devel@xxxxxxxxxxxxxxxxxxx > http://lists.xensource.com/xen-devel _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |