* [Qemu-devel] [PATCH] 9pfs: fix bogus fd check in local_remove()
@ 2017-03-03 16:17 Greg Kurz
2017-03-03 16:33 ` Eric Blake
0 siblings, 1 reply; 2+ messages in thread
From: Greg Kurz @ 2017-03-03 16:17 UTC (permalink / raw)
To: qemu-devel; +Cc: Greg Kurz
This was spotted by Coverity as a fd leak. This is certainly true, but also
local_remove() would always return without doing anything, unless the fd is
zero, which is very unlikely.
(Coverity issue CID1371732)
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/9pfs/9p-local.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index f22a3c3654db..5db7104334d6 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1008,7 +1008,7 @@ static int local_remove(FsContext *ctx, const char *path)
int err = -1;
dirfd = local_opendir_nofollow(ctx, dirpath);
- if (dirfd) {
+ if (dirfd == -1) {
goto out;
}
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCH] 9pfs: fix bogus fd check in local_remove()
2017-03-03 16:17 [Qemu-devel] [PATCH] 9pfs: fix bogus fd check in local_remove() Greg Kurz
@ 2017-03-03 16:33 ` Eric Blake
0 siblings, 0 replies; 2+ messages in thread
From: Eric Blake @ 2017-03-03 16:33 UTC (permalink / raw)
To: Greg Kurz, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 987 bytes --]
On 03/03/2017 10:17 AM, Greg Kurz wrote:
> This was spotted by Coverity as a fd leak. This is certainly true, but also
> local_remove() would always return without doing anything, unless the fd is
> zero, which is very unlikely.
>
> (Coverity issue CID1371732)
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> hw/9pfs/9p-local.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
Reviewed-by: Eric Blake <eblake@redhat.com>
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index f22a3c3654db..5db7104334d6 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -1008,7 +1008,7 @@ static int local_remove(FsContext *ctx, const char *path)
> int err = -1;
>
> dirfd = local_opendir_nofollow(ctx, dirpath);
> - if (dirfd) {
> + if (dirfd == -1) {
> goto out;
> }
>
>
>
>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2017-03-03 16:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 16:17 [Qemu-devel] [PATCH] 9pfs: fix bogus fd check in local_remove() Greg Kurz
2017-03-03 16:33 ` Eric Blake
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.