xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Ian Campbell <ian.campbell@citrix.com>
To: George Dunlap <George.Dunlap@citrix.com>
Cc: xen-devel <xen-devel@lists.xen.org>
Subject: Leaks in xc_tbuf_get_size() (Was: Re: New Defects reported by Coverity Scan for XenProject)
Date: Wed, 3 Feb 2016 10:37:05 +0000	[thread overview]
Message-ID: <1454495825.25207.50.camel@citrix.com> (raw)
In-Reply-To: <56b180c017d5f_214fb5b3143623f@ss1435.mail>

George,

Looks like xentrace is the only maintained component which uses this. so
tag ;-)

On Tue, 2016-02-02 at 20:23 -0800, scan-admin@coverity.com wrote:
> * CID 1351228:    (RESOURCE_LEAK)
> /tools/libxc/xc_tbuf.c: 73 in xc_tbuf_get_size()
> /tools/libxc/xc_tbuf.c: 77 in xc_tbuf_get_size()

Coverity is reporting these as new in 41b0aa569adb..9937763265d9 although
the file hasn't changed. However it does look correct that t_info is being
leaked by various paths in this function.

> 
> 
> _________________________________________________________________________
> _______________________________
> *** CID 1351228:    (RESOURCE_LEAK)
> /tools/libxc/xc_tbuf.c: 73 in xc_tbuf_get_size()
> 67     
> 68         t_info = xc_map_foreign_range(xch, DOMID_XEN,
> 69                         sysctl.u.tbuf_op.size, PROT_READ | PROT_WRITE,
> 70                         sysctl.u.tbuf_op.buffer_mfn);
> 71     
> 72         if ( t_info == NULL || t_info->tbuf_size == 0 )
> >>>     CID 1351228:    (RESOURCE_LEAK)
> >>>     Variable "t_info" going out of scope leaks the storage it points
> to.
> 73             return -1;
> 74     
> 75         *size = t_info->tbuf_size;
> 76     
> 77         return 0;
> 78     }
> /tools/libxc/xc_tbuf.c: 77 in xc_tbuf_get_size()
> 71     
> 72         if ( t_info == NULL || t_info->tbuf_size == 0 )
> 73             return -1;
> 74     
> 75         *size = t_info->tbuf_size;
> 76     
> >>>     CID 1351228:    (RESOURCE_LEAK)
> >>>     Variable "t_info" going out of scope leaks the storage it points
> to.
> 77         return 0;
> 78     }
> 79     
> 80     int xc_tbuf_enable(xc_interface *xch, unsigned long pages,
> unsigned long *mfn,
> 81                        unsigned long *size)
> 82     {
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

       reply	other threads:[~2016-02-03 10:37 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <56b180c017d5f_214fb5b3143623f@ss1435.mail>
2016-02-03 10:37 ` Ian Campbell [this message]
2016-02-03 10:42   ` Leaks in xc_tbuf_get_size() (Was: Re: New Defects reported by Coverity Scan for XenProject) Andrew Cooper
2016-02-03 10:54     ` Ian Campbell
2016-02-03 14:21   ` George Dunlap
2016-02-03 10:39 ` Leak in xc_dom_load_hvm_kernel() (Was; " Ian Campbell
2016-02-03 10:59   ` [PATCH] libxc: fix leak in xc_dom_load_hvm_kernel error path Roger Pau Monne
2016-02-03 11:49     ` Ian Campbell
2016-02-03 10:45 ` missing lock in percpu_rwlock? (Was: Re: New Defects reported by Coverity Scan for XenProject) Ian Campbell
2016-02-03 10:47   ` Ian Campbell
2016-02-03 10:50   ` Andrew Cooper
2016-02-03 11:00     ` Ian Campbell
2016-02-03 12:21       ` Andrew Cooper
2016-02-03 12:24         ` Andrew Cooper
2016-02-03 12:32           ` Ian Campbell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1454495825.25207.50.camel@citrix.com \
    --to=ian.campbell@citrix.com \
    --cc=George.Dunlap@citrix.com \
    --cc=xen-devel@lists.xen.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).