* [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid
@ 2016-04-04 15:09 Ian Jackson
2016-04-04 15:10 ` [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents Ian Jackson
2016-04-07 8:17 ` [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Chun Yan Liu
0 siblings, 2 replies; 8+ messages in thread
From: Ian Jackson @ 2016-04-04 15:09 UTC (permalink / raw)
To: xen-devel; +Cc: Simon Cao, Ian Jackson, George Dunlap, coverity, Chunyan Liu
We must set rc before using `goto out'.
Bug introduced in bf7628f0 "libxl: add pvusb API".
CID: 1358113
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: coverity@xenproject.org
CC: Simon Cao <caobosimon@gmail.com>
CC: George Dunlap <george.dunlap@citrix.com>
CC: Chunyan Liu <cyliu@suse.com>
---
tools/libxl/libxl_pvusb.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
index 5f92628..6f53317 100644
--- a/tools/libxl/libxl_pvusb.c
+++ b/tools/libxl/libxl_pvusb.c
@@ -905,6 +905,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc *gc, uint32_t domid,
usbdev->u.hostdev.hostaddr);
if (!busid) {
LOG(DEBUG, "Fail to get busid of usb device");
+ rc = ERROR_FAIL;
goto out;
}
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents
2016-04-04 15:09 [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Ian Jackson
@ 2016-04-04 15:10 ` Ian Jackson
2016-04-07 8:16 ` Chun Yan Liu
2016-04-07 8:17 ` [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Chun Yan Liu
1 sibling, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2016-04-04 15:10 UTC (permalink / raw)
To: xen-devel; +Cc: Ian Jackson, Chunyan Liu, coverity
Bug introduced in bc023ecd
"libxl_utils: add internal function to read sysfs file contents"
CID: 1358108
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
CC: coverity@xenproject.org
CC: Chunyan Liu <cyliu@suse.com>
---
tools/libxl/libxl_utils.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
index ceb8825..bd58a52 100644
--- a/tools/libxl/libxl_utils.c
+++ b/tools/libxl/libxl_utils.c
@@ -466,6 +466,7 @@ int libxl__read_sysfs_file_contents(libxl__gc *gc, const char *filename,
e = errno;
assert(e != ENOENT);
if (f) fclose(f);
+ free(data);
return e;
}
--
1.7.10.4
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents
2016-04-04 15:10 ` [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents Ian Jackson
@ 2016-04-07 8:16 ` Chun Yan Liu
2016-04-07 17:03 ` Ian Jackson
0 siblings, 1 reply; 8+ messages in thread
From: Chun Yan Liu @ 2016-04-07 8:16 UTC (permalink / raw)
To: Ian Jackson, xen-devel; +Cc: coverity
>>> On 4/4/2016 at 11:10 PM, in message
<1459782600-16073-2-git-send-email-ian.jackson@eu.citrix.com>, Ian Jackson
<ian.jackson@eu.citrix.com> wrote:
> Bug introduced in bc023ecd
> "libxl_utils: add internal function to read sysfs file contents"
>
> CID: 1358108
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: coverity@xenproject.org
> CC: Chunyan Liu <cyliu@suse.com>
> ---
> tools/libxl/libxl_utils.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/libxl/libxl_utils.c b/tools/libxl/libxl_utils.c
> index ceb8825..bd58a52 100644
> --- a/tools/libxl/libxl_utils.c
> +++ b/tools/libxl/libxl_utils.c
> @@ -466,6 +466,7 @@ int libxl__read_sysfs_file_contents(libxl__gc *gc, const
> char *filename,
> e = errno;
> assert(e != ENOENT);
> if (f) fclose(f);
> + free(data);
'data' is malloced with 'gc', it'll be freed by GC_FREE. Do we need to free
it here?
Chunyan
> return e;
> }
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid
2016-04-04 15:09 [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Ian Jackson
2016-04-04 15:10 ` [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents Ian Jackson
@ 2016-04-07 8:17 ` Chun Yan Liu
2016-04-07 17:04 ` Ian Jackson
1 sibling, 1 reply; 8+ messages in thread
From: Chun Yan Liu @ 2016-04-07 8:17 UTC (permalink / raw)
To: Ian Jackson, xen-devel; +Cc: Simon Cao, George Dunlap, coverity
Thanks, Ian!
>>> On 4/4/2016 at 11:09 PM, in message
<1459782600-16073-1-git-send-email-ian.jackson@eu.citrix.com>, Ian Jackson
<ian.jackson@eu.citrix.com> wrote:
> We must set rc before using `goto out'.
>
> Bug introduced in bf7628f0 "libxl: add pvusb API".
>
> CID: 1358113
> Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
> CC: coverity@xenproject.org
> CC: Simon Cao <caobosimon@gmail.com>
> CC: George Dunlap <george.dunlap@citrix.com>
> CC: Chunyan Liu <cyliu@suse.com>
> ---
> tools/libxl/libxl_pvusb.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/tools/libxl/libxl_pvusb.c b/tools/libxl/libxl_pvusb.c
> index 5f92628..6f53317 100644
> --- a/tools/libxl/libxl_pvusb.c
> +++ b/tools/libxl/libxl_pvusb.c
> @@ -905,6 +905,7 @@ static int libxl__device_usbdev_add_xenstore(libxl__gc
> *gc, uint32_t domid,
> usbdev->u.hostdev.hostaddr);
> if (!busid) {
> LOG(DEBUG, "Fail to get busid of usb device");
> + rc = ERROR_FAIL;
> goto out;
> }
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents
2016-04-07 8:16 ` Chun Yan Liu
@ 2016-04-07 17:03 ` Ian Jackson
0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2016-04-07 17:03 UTC (permalink / raw)
To: Chun Yan Liu; +Cc: xen-devel, coverity
Chun Yan Liu writes ("Re: [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents"):
> <1459782600-16073-2-git-send-email-ian.jackson@eu.citrix.com>, Ian Jackson
> <ian.jackson@eu.citrix.com> wrote:
> > + free(data);
>
> 'data' is malloced with 'gc', it'll be freed by GC_FREE. Do we need to free
> it here?
Oh, you are quite right. My patch was wrong.
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid
2016-04-07 8:17 ` [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Chun Yan Liu
@ 2016-04-07 17:04 ` Ian Jackson
2016-04-08 3:48 ` Chun Yan Liu
0 siblings, 1 reply; 8+ messages in thread
From: Ian Jackson @ 2016-04-07 17:04 UTC (permalink / raw)
To: Chun Yan Liu; +Cc: xen-devel, George Dunlap, coverity, Simon Cao
Chun Yan Liu writes ("Re: [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid"):
> Thanks, Ian!
Should I take that as a Reviewed-by ?
Thanks,
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid
2016-04-07 17:04 ` Ian Jackson
@ 2016-04-08 3:48 ` Chun Yan Liu
2016-04-08 13:34 ` Ian Jackson
0 siblings, 1 reply; 8+ messages in thread
From: Chun Yan Liu @ 2016-04-08 3:48 UTC (permalink / raw)
To: Ian Jackson; +Cc: xen-devel, Simon Cao, George Dunlap, coverity
>>> On 4/8/2016 at 01:04 AM, in message
<22278.37677.975595.101165@mariner.uk.xensource.com>, Ian Jackson
<Ian.Jackson@eu.citrix.com> wrote:
> Chun Yan Liu writes ("Re: [PATCH 1/2] libxl: Set rc on failure of
> usbdev_busaddr_to_busid"):
> > Thanks, Ian!
>
> Should I take that as a Reviewed-by ?
Ah, yes. Acked. :-)
Chunyan
>
> Thanks,
> Ian.
>
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid
2016-04-08 3:48 ` Chun Yan Liu
@ 2016-04-08 13:34 ` Ian Jackson
0 siblings, 0 replies; 8+ messages in thread
From: Ian Jackson @ 2016-04-08 13:34 UTC (permalink / raw)
To: Chun Yan Liu; +Cc: xen-devel, Simon Cao, George Dunlap, coverity
Chun Yan Liu writes ("Re: [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid"):
> On 4/8/2016 at 01:04 AM, in message
> <22278.37677.975595.101165@mariner.uk.xensource.com>, Ian Jackson
> <Ian.Jackson@eu.citrix.com> wrote:
> > Chun Yan Liu writes ("Re: [PATCH 1/2] libxl: Set rc on failure of
> > usbdev_busaddr_to_busid"):
> > > Thanks, Ian!
> >
> > Should I take that as a Reviewed-by ?
>
> Ah, yes. Acked. :-)
Thanks, queued.
Ian.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2016-04-08 13:34 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-04 15:09 [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Ian Jackson
2016-04-04 15:10 ` [PATCH 2/2] libxl: Do not leak data on error path from libxl__read_sysfs_file_contents Ian Jackson
2016-04-07 8:16 ` Chun Yan Liu
2016-04-07 17:03 ` Ian Jackson
2016-04-07 8:17 ` [PATCH 1/2] libxl: Set rc on failure of usbdev_busaddr_to_busid Chun Yan Liu
2016-04-07 17:04 ` Ian Jackson
2016-04-08 3:48 ` Chun Yan Liu
2016-04-08 13:34 ` Ian Jackson
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).