* [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
@ 2017-05-09 19:04 ` Stefano Stabellini
0 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:04 UTC (permalink / raw)
To: qemu-devel; +Cc: xen-devel, sstabellini, anthony.perard, groug, aneesh.kumar
CID: 1374836
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: anthony.perard@citrix.com
CC: groug@kaod.org
CC: aneesh.kumar@linux.vnet.ibm.com
---
hw/9pfs/xen-9p-backend.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 9c7f41a..a1fdede 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -332,12 +332,14 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
str = g_strdup_printf("ring-ref%u", i);
if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
&xen_9pdev->rings[i].ref) == -1) {
+ g_free(str);
goto out;
}
g_free(str);
str = g_strdup_printf("event-channel-%u", i);
if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
&xen_9pdev->rings[i].evtchn) == -1) {
+ g_free(str);
goto out;
}
g_free(str);
--
1.9.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
@ 2017-05-09 19:04 ` Stefano Stabellini
0 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:04 UTC (permalink / raw)
To: qemu-devel; +Cc: anthony.perard, aneesh.kumar, sstabellini, groug, xen-devel
CID: 1374836
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: anthony.perard@citrix.com
CC: groug@kaod.org
CC: aneesh.kumar@linux.vnet.ibm.com
---
hw/9pfs/xen-9p-backend.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index 9c7f41a..a1fdede 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -332,12 +332,14 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
str = g_strdup_printf("ring-ref%u", i);
if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
&xen_9pdev->rings[i].ref) == -1) {
+ g_free(str);
goto out;
}
g_free(str);
str = g_strdup_printf("event-channel-%u", i);
if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
&xen_9pdev->rings[i].evtchn) == -1) {
+ g_free(str);
goto out;
}
g_free(str);
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Qemu-devel] [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 19:04 ` Stefano Stabellini
-1 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:04 UTC (permalink / raw)
To: qemu-devel; +Cc: xen-devel, sstabellini, groug, pbonzini, Eric Blake
Assert that the return value is not an error. This issue was found by
Coverity.
CID: 1374831
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: groug@kaod.org
CC: pbonzini@redhat.com
CC: Eric Blake <eblake@redhat.com>
---
util/oslib-posix.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 4d9189e..16894ad 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
{
int f;
f = fcntl(fd, F_GETFD);
- fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+ assert(f != -1);
}
/*
--
1.9.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
@ 2017-05-09 19:04 ` Stefano Stabellini
0 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:04 UTC (permalink / raw)
To: qemu-devel; +Cc: pbonzini, sstabellini, Eric Blake, groug, xen-devel
Assert that the return value is not an error. This issue was found by
Coverity.
CID: 1374831
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: groug@kaod.org
CC: pbonzini@redhat.com
CC: Eric Blake <eblake@redhat.com>
---
util/oslib-posix.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/util/oslib-posix.c b/util/oslib-posix.c
index 4d9189e..16894ad 100644
--- a/util/oslib-posix.c
+++ b/util/oslib-posix.c
@@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
{
int f;
f = fcntl(fd, F_GETFD);
- fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+ assert(f != -1);
+ f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
+ assert(f != -1);
}
/*
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [Qemu-devel] [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 19:04 ` Stefano Stabellini
-1 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:04 UTC (permalink / raw)
To: qemu-devel
Cc: xen-devel, sstabellini, anthony.perard, groug, aneesh.kumar, Eric Blake
Use the common utility function, which contains checks on return values,
instead of manually calling fcntl.
CID: 1374831
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: anthony.perard@citrix.com
CC: groug@kaod.org
CC: aneesh.kumar@linux.vnet.ibm.com
CC: Eric Blake <eblake@redhat.com>
---
hw/9pfs/xen-9p-backend.c | 2 +-
hw/xen/xen_backend.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index a1fdede..5df97c9 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -380,7 +380,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
if (xen_9pdev->rings[i].evtchndev == NULL) {
goto out;
}
- fcntl(xenevtchn_fd(xen_9pdev->rings[i].evtchndev), F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(xenevtchn_fd(xen_9pdev->rings[i].evtchndev));
xen_9pdev->rings[i].local_port = xenevtchn_bind_interdomain
(xen_9pdev->rings[i].evtchndev,
xendev->dom,
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index c85f163..2cac47d 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -147,7 +147,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
qdev_unplug(DEVICE(xendev), NULL);
return NULL;
}
- fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(xenevtchn_fd(xendev->evtchndev));
if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
xendev->gnttabdev = xengnttab_open(NULL, 0);
--
1.9.1
^ permalink raw reply related [flat|nested] 26+ messages in thread
* [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl
@ 2017-05-09 19:04 ` Stefano Stabellini
0 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:04 UTC (permalink / raw)
To: qemu-devel
Cc: sstabellini, groug, xen-devel, aneesh.kumar, anthony.perard, Eric Blake
Use the common utility function, which contains checks on return values,
instead of manually calling fcntl.
CID: 1374831
Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
CC: anthony.perard@citrix.com
CC: groug@kaod.org
CC: aneesh.kumar@linux.vnet.ibm.com
CC: Eric Blake <eblake@redhat.com>
---
hw/9pfs/xen-9p-backend.c | 2 +-
hw/xen/xen_backend.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
index a1fdede..5df97c9 100644
--- a/hw/9pfs/xen-9p-backend.c
+++ b/hw/9pfs/xen-9p-backend.c
@@ -380,7 +380,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
if (xen_9pdev->rings[i].evtchndev == NULL) {
goto out;
}
- fcntl(xenevtchn_fd(xen_9pdev->rings[i].evtchndev), F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(xenevtchn_fd(xen_9pdev->rings[i].evtchndev));
xen_9pdev->rings[i].local_port = xenevtchn_bind_interdomain
(xen_9pdev->rings[i].evtchndev,
xendev->dom,
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index c85f163..2cac47d 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -147,7 +147,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
qdev_unplug(DEVICE(xendev), NULL);
return NULL;
}
- fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
+ qemu_set_cloexec(xenevtchn_fd(xendev->evtchndev));
if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
xendev->gnttabdev = xengnttab_open(NULL, 0);
--
1.9.1
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 19:20 ` Eric Blake
-1 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:20 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel
Cc: anthony.perard, aneesh.kumar, groug, xen-devel
[-- Attachment #1: Type: text/plain, Size: 485 bytes --]
On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> CID: 1374836
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> ---
> hw/9pfs/xen-9p-backend.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
@ 2017-05-09 19:20 ` Eric Blake
0 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:20 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel
Cc: anthony.perard, xen-devel, aneesh.kumar, groug
[-- Attachment #1.1.1: Type: text/plain, Size: 485 bytes --]
On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> CID: 1374836
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> ---
> hw/9pfs/xen-9p-backend.c | 2 ++
> 1 file changed, 2 insertions(+)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 19:20 ` Eric Blake
-1 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:20 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel; +Cc: xen-devel, groug, pbonzini
[-- Attachment #1: Type: text/plain, Size: 579 bytes --]
On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> Assert that the return value is not an error. This issue was found by
> Coverity.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: groug@kaod.org
> CC: pbonzini@redhat.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> util/oslib-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
@ 2017-05-09 19:20 ` Eric Blake
0 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:20 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel; +Cc: pbonzini, groug, xen-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 579 bytes --]
On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> Assert that the return value is not an error. This issue was found by
> Coverity.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: groug@kaod.org
> CC: pbonzini@redhat.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> util/oslib-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 19:21 ` Eric Blake
-1 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:21 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel
Cc: xen-devel, anthony.perard, groug, aneesh.kumar
[-- Attachment #1: Type: text/plain, Size: 698 bytes --]
On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> Use the common utility function, which contains checks on return values,
> instead of manually calling fcntl.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> hw/9pfs/xen-9p-backend.c | 2 +-
> hw/xen/xen_backend.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl
@ 2017-05-09 19:21 ` Eric Blake
0 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:21 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel
Cc: anthony.perard, aneesh.kumar, groug, xen-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 698 bytes --]
On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> Use the common utility function, which contains checks on return values,
> instead of manually calling fcntl.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> hw/9pfs/xen-9p-backend.c | 2 +-
> hw/xen/xen_backend.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
2017-05-09 19:20 ` Eric Blake
@ 2017-05-09 19:28 ` Eric Blake
-1 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:28 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel
Cc: anthony.perard, xen-devel, aneesh.kumar, groug
[-- Attachment #1: Type: text/plain, Size: 1090 bytes --]
On 05/09/2017 02:20 PM, Eric Blake wrote:
> On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
>> CID: 1374836
>>
>> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
>> CC: anthony.perard@citrix.com
>> CC: groug@kaod.org
>> CC: aneesh.kumar@linux.vnet.ibm.com
>> ---
>> hw/9pfs/xen-9p-backend.c | 2 ++
>> 1 file changed, 2 insertions(+)
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
By the way, you forgot to send a 0/3 cover letter (at least, there was
no In-Reply-To: header in your 1/3 mail). That makes it harder to
automate handling of your series; I was going to reply to the series as
a whole.
While it is inconvenient for human readers, it is even worse for some of
the automated patch tooling we have that expects cover letters for any
multi-patch series. More patch submission tips at
http://wiki.qemu.org/Contribute/SubmitAPatch include how to use 'git
config' to automate the creation of a cover letter.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
@ 2017-05-09 19:28 ` Eric Blake
0 siblings, 0 replies; 26+ messages in thread
From: Eric Blake @ 2017-05-09 19:28 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel
Cc: anthony.perard, groug, aneesh.kumar, xen-devel
[-- Attachment #1.1.1: Type: text/plain, Size: 1090 bytes --]
On 05/09/2017 02:20 PM, Eric Blake wrote:
> On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
>> CID: 1374836
>>
>> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
>> CC: anthony.perard@citrix.com
>> CC: groug@kaod.org
>> CC: aneesh.kumar@linux.vnet.ibm.com
>> ---
>> hw/9pfs/xen-9p-backend.c | 2 ++
>> 1 file changed, 2 insertions(+)
>
> Reviewed-by: Eric Blake <eblake@redhat.com>
By the way, you forgot to send a 0/3 cover letter (at least, there was
no In-Reply-To: header in your 1/3 mail). That makes it harder to
automate handling of your series; I was going to reply to the series as
a whole.
While it is inconvenient for human readers, it is even worse for some of
the automated patch tooling we have that expects cover letters for any
multi-patch series. More patch submission tips at
http://wiki.qemu.org/Contribute/SubmitAPatch include how to use 'git
config' to automate the creation of a cover letter.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
2017-05-09 19:28 ` Eric Blake
@ 2017-05-09 19:47 ` Stefano Stabellini
-1 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:47 UTC (permalink / raw)
To: Eric Blake
Cc: Stefano Stabellini, qemu-devel, anthony.perard, xen-devel,
aneesh.kumar, groug
On Tue, 9 May 2017, Eric Blake wrote:
> On 05/09/2017 02:20 PM, Eric Blake wrote:
> > On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> >> CID: 1374836
> >>
> >> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> >> CC: anthony.perard@citrix.com
> >> CC: groug@kaod.org
> >> CC: aneesh.kumar@linux.vnet.ibm.com
> >> ---
> >> hw/9pfs/xen-9p-backend.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >
> > Reviewed-by: Eric Blake <eblake@redhat.com>
>
> By the way, you forgot to send a 0/3 cover letter (at least, there was
> no In-Reply-To: header in your 1/3 mail). That makes it harder to
> automate handling of your series; I was going to reply to the series as
> a whole.
>
> While it is inconvenient for human readers, it is even worse for some of
> the automated patch tooling we have that expects cover letters for any
> multi-patch series. More patch submission tips at
> http://wiki.qemu.org/Contribute/SubmitAPatch include how to use 'git
> config' to automate the creation of a cover letter.
Sorry about that, and thanks for the review.
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
@ 2017-05-09 19:47 ` Stefano Stabellini
0 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-09 19:47 UTC (permalink / raw)
To: Eric Blake
Cc: Stefano Stabellini, groug, qemu-devel, aneesh.kumar,
anthony.perard, xen-devel
On Tue, 9 May 2017, Eric Blake wrote:
> On 05/09/2017 02:20 PM, Eric Blake wrote:
> > On 05/09/2017 02:04 PM, Stefano Stabellini wrote:
> >> CID: 1374836
> >>
> >> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> >> CC: anthony.perard@citrix.com
> >> CC: groug@kaod.org
> >> CC: aneesh.kumar@linux.vnet.ibm.com
> >> ---
> >> hw/9pfs/xen-9p-backend.c | 2 ++
> >> 1 file changed, 2 insertions(+)
> >
> > Reviewed-by: Eric Blake <eblake@redhat.com>
>
> By the way, you forgot to send a 0/3 cover letter (at least, there was
> no In-Reply-To: header in your 1/3 mail). That makes it harder to
> automate handling of your series; I was going to reply to the series as
> a whole.
>
> While it is inconvenient for human readers, it is even worse for some of
> the automated patch tooling we have that expects cover letters for any
> multi-patch series. More patch submission tips at
> http://wiki.qemu.org/Contribute/SubmitAPatch include how to use 'git
> config' to automate the creation of a cover letter.
Sorry about that, and thanks for the review.
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 20:29 ` Greg Kurz
-1 siblings, 0 replies; 26+ messages in thread
From: Greg Kurz @ 2017-05-09 20:29 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: qemu-devel, xen-devel, anthony.perard, aneesh.kumar
[-- Attachment #1: Type: text/plain, Size: 1596 bytes --]
On Tue, 9 May 2017 12:04:51 -0700
Stefano Stabellini <sstabellini@kernel.org> wrote:
> CID: 1374836
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> ---
> hw/9pfs/xen-9p-backend.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
> index 9c7f41a..a1fdede 100644
> --- a/hw/9pfs/xen-9p-backend.c
> +++ b/hw/9pfs/xen-9p-backend.c
> @@ -332,12 +332,14 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
> str = g_strdup_printf("ring-ref%u", i);
> if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
> &xen_9pdev->rings[i].ref) == -1) {
> + g_free(str);
> goto out;
> }
> g_free(str);
I would rather do something like:
int ret;
[...]
str = g_strdup_printf("ring-ref%u", i);
ret = xenstore_read_fe_int(&xen_9pdev->xendev, str,
&xen_9pdev->rings[i].ref);
g_free(str);
if (ret == -1) {
goto out;
}
but this is a matter of taste and you own this code so:
Reviewed-by: Greg Kurz <groug@kaod.org>
> str = g_strdup_printf("event-channel-%u", i);
> if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
> &xen_9pdev->rings[i].evtchn) == -1) {
> + g_free(str);
> goto out;
> }
> g_free(str);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity
@ 2017-05-09 20:29 ` Greg Kurz
0 siblings, 0 replies; 26+ messages in thread
From: Greg Kurz @ 2017-05-09 20:29 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: anthony.perard, aneesh.kumar, qemu-devel, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 1596 bytes --]
On Tue, 9 May 2017 12:04:51 -0700
Stefano Stabellini <sstabellini@kernel.org> wrote:
> CID: 1374836
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> ---
> hw/9pfs/xen-9p-backend.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
> index 9c7f41a..a1fdede 100644
> --- a/hw/9pfs/xen-9p-backend.c
> +++ b/hw/9pfs/xen-9p-backend.c
> @@ -332,12 +332,14 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
> str = g_strdup_printf("ring-ref%u", i);
> if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
> &xen_9pdev->rings[i].ref) == -1) {
> + g_free(str);
> goto out;
> }
> g_free(str);
I would rather do something like:
int ret;
[...]
str = g_strdup_printf("ring-ref%u", i);
ret = xenstore_read_fe_int(&xen_9pdev->xendev, str,
&xen_9pdev->rings[i].ref);
g_free(str);
if (ret == -1) {
goto out;
}
but this is a matter of taste and you own this code so:
Reviewed-by: Greg Kurz <groug@kaod.org>
> str = g_strdup_printf("event-channel-%u", i);
> if (xenstore_read_fe_int(&xen_9pdev->xendev, str,
> &xen_9pdev->rings[i].evtchn) == -1) {
> + g_free(str);
> goto out;
> }
> g_free(str);
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 20:31 ` Greg Kurz
-1 siblings, 0 replies; 26+ messages in thread
From: Greg Kurz @ 2017-05-09 20:31 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: qemu-devel, xen-devel, pbonzini, Eric Blake
[-- Attachment #1: Type: text/plain, Size: 899 bytes --]
On Tue, 9 May 2017 12:04:52 -0700
Stefano Stabellini <sstabellini@kernel.org> wrote:
> Assert that the return value is not an error. This issue was found by
> Coverity.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: groug@kaod.org
> CC: pbonzini@redhat.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> util/oslib-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Greg Kurz <groug@kaod.org>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4d9189e..16894ad 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
> {
> int f;
> f = fcntl(fd, F_GETFD);
> - fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> + f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> }
>
> /*
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
@ 2017-05-09 20:31 ` Greg Kurz
0 siblings, 0 replies; 26+ messages in thread
From: Greg Kurz @ 2017-05-09 20:31 UTC (permalink / raw)
To: Stefano Stabellini; +Cc: pbonzini, Eric Blake, qemu-devel, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 899 bytes --]
On Tue, 9 May 2017 12:04:52 -0700
Stefano Stabellini <sstabellini@kernel.org> wrote:
> Assert that the return value is not an error. This issue was found by
> Coverity.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: groug@kaod.org
> CC: pbonzini@redhat.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> util/oslib-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
Reviewed-by: Greg Kurz <groug@kaod.org>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4d9189e..16894ad 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
> {
> int f;
> f = fcntl(fd, F_GETFD);
> - fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> + f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> }
>
> /*
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-09 20:54 ` Greg Kurz
-1 siblings, 0 replies; 26+ messages in thread
From: Greg Kurz @ 2017-05-09 20:54 UTC (permalink / raw)
To: Stefano Stabellini
Cc: qemu-devel, xen-devel, anthony.perard, aneesh.kumar, Eric Blake
[-- Attachment #1: Type: text/plain, Size: 2420 bytes --]
On Tue, 9 May 2017 12:04:53 -0700
Stefano Stabellini <sstabellini@kernel.org> wrote:
> Use the common utility function, which contains checks on return values,
... and first calls F_GETFD as recommended by POSIX.1-2001.
http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html
"The arg values to F_GETFD, F_SETFD, F_GETFL, and F_SETFL all represent
flag values to allow for future growth. Applications using these functions
should do a read-modify-write operation on them, rather than assuming that
only the values defined by this volume of IEEE Std 1003.1-2001 are valid.
It is a common error to forget this, particularly in the case of F_SETFD."
> instead of manually calling fcntl.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> hw/9pfs/xen-9p-backend.c | 2 +-
> hw/xen/xen_backend.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Anyway,
Reviewed-by: Greg Kurz <groug@kaod.org>
> diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
> index a1fdede..5df97c9 100644
> --- a/hw/9pfs/xen-9p-backend.c
> +++ b/hw/9pfs/xen-9p-backend.c
> @@ -380,7 +380,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
> if (xen_9pdev->rings[i].evtchndev == NULL) {
> goto out;
> }
> - fcntl(xenevtchn_fd(xen_9pdev->rings[i].evtchndev), F_SETFD,
> FD_CLOEXEC);
> + qemu_set_cloexec(xenevtchn_fd(xen_9pdev->rings[i].evtchndev));
> xen_9pdev->rings[i].local_port = xenevtchn_bind_interdomain
> (xen_9pdev->rings[i].evtchndev,
> xendev->dom,
> diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
> index c85f163..2cac47d 100644
> --- a/hw/xen/xen_backend.c
> +++ b/hw/xen/xen_backend.c
> @@ -147,7 +147,7 @@ static struct XenDevice *xen_be_get_xendev(const char
> *type, int dom, int dev, qdev_unplug(DEVICE(xendev), NULL);
> return NULL;
> }
> - fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
> + qemu_set_cloexec(xenevtchn_fd(xendev->evtchndev));
>
> if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
> xendev->gnttabdev = xengnttab_open(NULL, 0);
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl
@ 2017-05-09 20:54 ` Greg Kurz
0 siblings, 0 replies; 26+ messages in thread
From: Greg Kurz @ 2017-05-09 20:54 UTC (permalink / raw)
To: Stefano Stabellini
Cc: anthony.perard, aneesh.kumar, Eric Blake, qemu-devel, xen-devel
[-- Attachment #1.1: Type: text/plain, Size: 2420 bytes --]
On Tue, 9 May 2017 12:04:53 -0700
Stefano Stabellini <sstabellini@kernel.org> wrote:
> Use the common utility function, which contains checks on return values,
... and first calls F_GETFD as recommended by POSIX.1-2001.
http://pubs.opengroup.org/onlinepubs/009695399/functions/fcntl.html
"The arg values to F_GETFD, F_SETFD, F_GETFL, and F_SETFL all represent
flag values to allow for future growth. Applications using these functions
should do a read-modify-write operation on them, rather than assuming that
only the values defined by this volume of IEEE Std 1003.1-2001 are valid.
It is a common error to forget this, particularly in the case of F_SETFD."
> instead of manually calling fcntl.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: anthony.perard@citrix.com
> CC: groug@kaod.org
> CC: aneesh.kumar@linux.vnet.ibm.com
> CC: Eric Blake <eblake@redhat.com>
> ---
> hw/9pfs/xen-9p-backend.c | 2 +-
> hw/xen/xen_backend.c | 2 +-
> 2 files changed, 2 insertions(+), 2 deletions(-)
>
Anyway,
Reviewed-by: Greg Kurz <groug@kaod.org>
> diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c
> index a1fdede..5df97c9 100644
> --- a/hw/9pfs/xen-9p-backend.c
> +++ b/hw/9pfs/xen-9p-backend.c
> @@ -380,7 +380,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev)
> if (xen_9pdev->rings[i].evtchndev == NULL) {
> goto out;
> }
> - fcntl(xenevtchn_fd(xen_9pdev->rings[i].evtchndev), F_SETFD,
> FD_CLOEXEC);
> + qemu_set_cloexec(xenevtchn_fd(xen_9pdev->rings[i].evtchndev));
> xen_9pdev->rings[i].local_port = xenevtchn_bind_interdomain
> (xen_9pdev->rings[i].evtchndev,
> xendev->dom,
> diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
> index c85f163..2cac47d 100644
> --- a/hw/xen/xen_backend.c
> +++ b/hw/xen/xen_backend.c
> @@ -147,7 +147,7 @@ static struct XenDevice *xen_be_get_xendev(const char
> *type, int dom, int dev, qdev_unplug(DEVICE(xendev), NULL);
> return NULL;
> }
> - fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
> + qemu_set_cloexec(xenevtchn_fd(xendev->evtchndev));
>
> if (ops->flags & DEVOPS_FLAG_NEED_GNTDEV) {
> xendev->gnttabdev = xengnttab_open(NULL, 0);
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
2017-05-09 19:04 ` Stefano Stabellini
@ 2017-05-11 7:55 ` Paolo Bonzini
-1 siblings, 0 replies; 26+ messages in thread
From: Paolo Bonzini @ 2017-05-11 7:55 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel; +Cc: xen-devel, groug, Eric Blake
On 09/05/2017 21:04, Stefano Stabellini wrote:
> Assert that the return value is not an error. This issue was found by
> Coverity.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: groug@kaod.org
> CC: pbonzini@redhat.com
> CC: Eric Blake <eblake@redhat.com>
Queued, thanks.
Paolo
> ---
> util/oslib-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4d9189e..16894ad 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
> {
> int f;
> f = fcntl(fd, F_GETFD);
> - fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> + f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> }
>
> /*
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
@ 2017-05-11 7:55 ` Paolo Bonzini
0 siblings, 0 replies; 26+ messages in thread
From: Paolo Bonzini @ 2017-05-11 7:55 UTC (permalink / raw)
To: Stefano Stabellini, qemu-devel; +Cc: Eric Blake, groug, xen-devel
On 09/05/2017 21:04, Stefano Stabellini wrote:
> Assert that the return value is not an error. This issue was found by
> Coverity.
>
> CID: 1374831
>
> Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> CC: groug@kaod.org
> CC: pbonzini@redhat.com
> CC: Eric Blake <eblake@redhat.com>
Queued, thanks.
Paolo
> ---
> util/oslib-posix.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> index 4d9189e..16894ad 100644
> --- a/util/oslib-posix.c
> +++ b/util/oslib-posix.c
> @@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
> {
> int f;
> f = fcntl(fd, F_GETFD);
> - fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> + f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> + assert(f != -1);
> }
>
> /*
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [Qemu-devel] [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
2017-05-11 7:55 ` Paolo Bonzini
@ 2017-05-16 18:53 ` Stefano Stabellini
-1 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-16 18:53 UTC (permalink / raw)
To: Paolo Bonzini
Cc: Stefano Stabellini, qemu-devel, xen-devel, groug, Eric Blake
On Thu, 11 May 2017, Paolo Bonzini wrote:
> On 09/05/2017 21:04, Stefano Stabellini wrote:
> > Assert that the return value is not an error. This issue was found by
> > Coverity.
> >
> > CID: 1374831
> >
> > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > CC: groug@kaod.org
> > CC: pbonzini@redhat.com
> > CC: Eric Blake <eblake@redhat.com>
>
> Queued, thanks.
I am about to send a pull request with the rest of the series, but I'll
leave this one to you.
Cheers,
Stefano
> > ---
> > util/oslib-posix.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> > index 4d9189e..16894ad 100644
> > --- a/util/oslib-posix.c
> > +++ b/util/oslib-posix.c
> > @@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
> > {
> > int f;
> > f = fcntl(fd, F_GETFD);
> > - fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> > + assert(f != -1);
> > + f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> > + assert(f != -1);
> > }
> >
> > /*
> >
>
^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec
@ 2017-05-16 18:53 ` Stefano Stabellini
0 siblings, 0 replies; 26+ messages in thread
From: Stefano Stabellini @ 2017-05-16 18:53 UTC (permalink / raw)
To: Paolo Bonzini
Cc: groug, Stefano Stabellini, Eric Blake, qemu-devel, xen-devel
On Thu, 11 May 2017, Paolo Bonzini wrote:
> On 09/05/2017 21:04, Stefano Stabellini wrote:
> > Assert that the return value is not an error. This issue was found by
> > Coverity.
> >
> > CID: 1374831
> >
> > Signed-off-by: Stefano Stabellini <sstabellini@kernel.org>
> > CC: groug@kaod.org
> > CC: pbonzini@redhat.com
> > CC: Eric Blake <eblake@redhat.com>
>
> Queued, thanks.
I am about to send a pull request with the rest of the series, but I'll
leave this one to you.
Cheers,
Stefano
> > ---
> > util/oslib-posix.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/util/oslib-posix.c b/util/oslib-posix.c
> > index 4d9189e..16894ad 100644
> > --- a/util/oslib-posix.c
> > +++ b/util/oslib-posix.c
> > @@ -182,7 +182,9 @@ void qemu_set_cloexec(int fd)
> > {
> > int f;
> > f = fcntl(fd, F_GETFD);
> > - fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> > + assert(f != -1);
> > + f = fcntl(fd, F_SETFD, f | FD_CLOEXEC);
> > + assert(f != -1);
> > }
> >
> > /*
> >
>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2017-05-16 18:53 UTC | newest]
Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-09 19:04 [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity Stefano Stabellini
2017-05-09 19:04 ` Stefano Stabellini
2017-05-09 19:04 ` [Qemu-devel] [PATCH v2 2/3] Check the return value of fcntl in qemu_set_cloexec Stefano Stabellini
2017-05-09 19:04 ` Stefano Stabellini
2017-05-09 19:20 ` [Qemu-devel] " Eric Blake
2017-05-09 19:20 ` Eric Blake
2017-05-09 20:31 ` [Qemu-devel] " Greg Kurz
2017-05-09 20:31 ` Greg Kurz
2017-05-11 7:55 ` [Qemu-devel] " Paolo Bonzini
2017-05-11 7:55 ` Paolo Bonzini
2017-05-16 18:53 ` [Qemu-devel] " Stefano Stabellini
2017-05-16 18:53 ` Stefano Stabellini
2017-05-09 19:04 ` [Qemu-devel] [PATCH v2 3/3] xen: call qemu_set_cloexec instead of fcntl Stefano Stabellini
2017-05-09 19:04 ` Stefano Stabellini
2017-05-09 19:21 ` [Qemu-devel] " Eric Blake
2017-05-09 19:21 ` Eric Blake
2017-05-09 20:54 ` [Qemu-devel] " Greg Kurz
2017-05-09 20:54 ` Greg Kurz
2017-05-09 19:20 ` [Qemu-devel] [PATCH v2 1/3] xen/9pfs: fix two resource leaks on error paths, discovered by Coverity Eric Blake
2017-05-09 19:20 ` Eric Blake
2017-05-09 19:28 ` Eric Blake
2017-05-09 19:28 ` Eric Blake
2017-05-09 19:47 ` Stefano Stabellini
2017-05-09 19:47 ` Stefano Stabellini
2017-05-09 20:29 ` Greg Kurz
2017-05-09 20:29 ` Greg Kurz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.