[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] x86/hvm_event: fix uninitialized struct field usage introduced by c/s f5365e6




On Feb 18, 2016 03:46, "Razvan Cojocaru" <rcojocaru@xxxxxxxxxxxxxxx> wrote:
>
> On 02/18/2016 12:45 PM, Corneliu ZUZU wrote:
> > c/s f5365e6: "xen/vm-events: Move parts of monitor_domctl code to common-side",
> > introduced a use without initialization issue.
> > hvm_event_breakpoint calls hvm_event_traps(&req) and if sync is true that
> > ors some bits into req->flags which was never initialised.
> > Reported by Coverity Scan.
> >
> > Initializes req @ hvm_event_breakpoint entry.
> >
> > Signed-off-by: Corneliu ZUZU <czuzu@xxxxxxxxxxxxxxx>
> > ---
> >Â xen/arch/x86/hvm/event.c | 2 +-
> >Â 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/xen/arch/x86/hvm/event.c b/xen/arch/x86/hvm/event.c
> > index 874a36c..cb9c152 100644
> > --- a/xen/arch/x86/hvm/event.c
> > +++ b/xen/arch/x86/hvm/event.c
> > @@ -173,7 +173,7 @@ int hvm_event_breakpoint(unsigned long rip,
> >Â {
> >Â Â Â struct vcpu *curr = current;
> >Â Â Â struct arch_domain *ad = &curr->domain->arch;
> > -Â Â vm_event_request_t req;
> > +Â Â vm_event_request_t req = {};

Should this be = { 0 } instead? Also, as I recall the request is not initialized on any of the paths, so we might as well do it for all of them, not just here. It would help avoid the listener erronously using some fields that were not actually initialized as well.

Tamas

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.