diff mbox

tools: libxencall/foreignmemory: initialise handle->fd

Message ID 1454494182-14767-1-git-send-email-ian.campbell@citrix.com
State New, archived
Headers show

Commit Message

Ian Campbell Feb. 3, 2016, 10:09 a.m. UTC
Otherwise the osdep close on the error path touches an uninitialised
varialble.

CID: 1351231 (foreignmemory) and 1351230 (call)

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
---
 tools/libs/call/core.c          | 2 ++
 tools/libs/foreignmemory/core.c | 1 +
 2 files changed, 3 insertions(+)

Comments

Wei Liu Feb. 3, 2016, 10:15 a.m. UTC | #1
On Wed, Feb 03, 2016 at 10:09:42AM +0000, Ian Campbell wrote:
> Otherwise the osdep close on the error path touches an uninitialised
> varialble.
> 
> CID: 1351231 (foreignmemory) and 1351230 (call)
> 
> Signed-off-by: Ian Campbell <ian.campbell@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
>  tools/libs/call/core.c          | 2 ++
>  tools/libs/foreignmemory/core.c | 1 +
>  2 files changed, 3 insertions(+)
> 
> diff --git a/tools/libs/call/core.c b/tools/libs/call/core.c
> index bbf88de..5ca0372 100644
> --- a/tools/libs/call/core.c
> +++ b/tools/libs/call/core.c
> @@ -24,6 +24,8 @@ xencall_handle *xencall_open(xentoollog_logger *logger, unsigned open_flags)
>  
>      if (!xcall) return NULL;
>  
> +    xcall->fd = -1;
> +
>      xcall->flags = open_flags;
>      xcall->buffer_cache_nr = 0;
>  
> diff --git a/tools/libs/foreignmemory/core.c b/tools/libs/foreignmemory/core.c
> index cfb0a73..6591888 100644
> --- a/tools/libs/foreignmemory/core.c
> +++ b/tools/libs/foreignmemory/core.c
> @@ -27,6 +27,7 @@ xenforeignmemory_handle *xenforeignmemory_open(xentoollog_logger *logger,
>  
>      if (!fmem) return NULL;
>  
> +    fmem->fd = -1;
>      fmem->logger = logger;
>      fmem->logger_tofree = NULL;
>  
> -- 
> 2.1.4
>
Ian Campbell Feb. 3, 2016, 11:49 a.m. UTC | #2
On Wed, 2016-02-03 at 10:15 +0000, Wei Liu wrote:
> On Wed, Feb 03, 2016 at 10:09:42AM +0000, Ian Campbell wrote:
> > Otherwise the osdep close on the error path touches an uninitialised
> > varialble.
> > 
> > CID: 1351231 (foreignmemory) and 1351230 (call)
> > 
> > Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
> 
> Acked-by: Wei Liu <wei.liu2@citrix.com>

Applied, thanks.
diff mbox

Patch

diff --git a/tools/libs/call/core.c b/tools/libs/call/core.c
index bbf88de..5ca0372 100644
--- a/tools/libs/call/core.c
+++ b/tools/libs/call/core.c
@@ -24,6 +24,8 @@  xencall_handle *xencall_open(xentoollog_logger *logger, unsigned open_flags)
 
     if (!xcall) return NULL;
 
+    xcall->fd = -1;
+
     xcall->flags = open_flags;
     xcall->buffer_cache_nr = 0;
 
diff --git a/tools/libs/foreignmemory/core.c b/tools/libs/foreignmemory/core.c
index cfb0a73..6591888 100644
--- a/tools/libs/foreignmemory/core.c
+++ b/tools/libs/foreignmemory/core.c
@@ -27,6 +27,7 @@  xenforeignmemory_handle *xenforeignmemory_open(xentoollog_logger *logger,
 
     if (!fmem) return NULL;
 
+    fmem->fd = -1;
     fmem->logger = logger;
     fmem->logger_tofree = NULL;