* [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier
@ 2017-03-03 18:03 Greg Kurz
2017-03-03 18:13 ` Daniel P. Berrange
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Greg Kurz @ 2017-03-03 18:03 UTC (permalink / raw)
To: qemu-devel; +Cc: Daniel P. Berrange, Eric Blake, Greg Kurz
If we cannot open the given path, we can return right away instead of
passing -1 to fstatfs() and close(). This will make Coverity happy.
(Coverity issue CID1371729)
Signed-off-by: Greg Kurz <groug@kaod.org>
---
hw/9pfs/9p-local.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
index fe930300445a..ea9a1ced0394 100644
--- a/hw/9pfs/9p-local.c
+++ b/hw/9pfs/9p-local.c
@@ -1053,6 +1053,9 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
int fd, ret;
fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0);
+ if (fd == -1) {
+ return -1;
+ }
ret = fstatfs(fd, stbuf);
close_preserve_errno(fd);
return ret;
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier
2017-03-03 18:03 [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier Greg Kurz
@ 2017-03-03 18:13 ` Daniel P. Berrange
2017-03-03 18:15 ` Eric Blake
2017-03-03 20:00 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Daniel P. Berrange @ 2017-03-03 18:13 UTC (permalink / raw)
To: Greg Kurz; +Cc: qemu-devel, Eric Blake
On Fri, Mar 03, 2017 at 07:03:47PM +0100, Greg Kurz wrote:
> If we cannot open the given path, we can return right away instead of
> passing -1 to fstatfs() and close(). This will make Coverity happy.
>
> (Coverity issue CID1371729)
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> hw/9pfs/9p-local.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index fe930300445a..ea9a1ced0394 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -1053,6 +1053,9 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
> int fd, ret;
>
> fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0);
> + if (fd == -1) {
> + return -1;
> + }
> ret = fstatfs(fd, stbuf);
> close_preserve_errno(fd);
> return ret;
Reviewed-by: Daniel P. berrange <berrange@redhat.com>
Regards,
Daniel
--
|: http://berrange.com -o- http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org -o- http://virt-manager.org :|
|: http://entangle-photo.org -o- http://search.cpan.org/~danberr/ :|
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier
2017-03-03 18:03 [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier Greg Kurz
2017-03-03 18:13 ` Daniel P. Berrange
@ 2017-03-03 18:15 ` Eric Blake
2017-03-03 20:00 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Eric Blake @ 2017-03-03 18:15 UTC (permalink / raw)
To: Greg Kurz, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 631 bytes --]
On 03/03/2017 12:03 PM, Greg Kurz wrote:
> If we cannot open the given path, we can return right away instead of
> passing -1 to fstatfs() and close(). This will make Coverity happy.
>
> (Coverity issue CID1371729)
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
> ---
> hw/9pfs/9p-local.c | 3 +++
> 1 file changed, 3 insertions(+)
No difference in end-user observable behavior, but arguably nicer (and
always more efficient to avoid unneeded syscalls).
Reviewed-by: Eric Blake <eblake@redhat.com>
--
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] 4+ messages in thread
* Re: [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier
2017-03-03 18:03 [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier Greg Kurz
2017-03-03 18:13 ` Daniel P. Berrange
2017-03-03 18:15 ` Eric Blake
@ 2017-03-03 20:00 ` Philippe Mathieu-Daudé
2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2017-03-03 20:00 UTC (permalink / raw)
To: Greg Kurz, qemu-devel
On 03/03/2017 03:03 PM, Greg Kurz wrote:
> If we cannot open the given path, we can return right away instead of
> passing -1 to fstatfs() and close(). This will make Coverity happy.
>
> (Coverity issue CID1371729)
>
> Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
> ---
> hw/9pfs/9p-local.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c
> index fe930300445a..ea9a1ced0394 100644
> --- a/hw/9pfs/9p-local.c
> +++ b/hw/9pfs/9p-local.c
> @@ -1053,6 +1053,9 @@ static int local_statfs(FsContext *s, V9fsPath *fs_path, struct statfs *stbuf)
> int fd, ret;
>
> fd = local_open_nofollow(s, fs_path->data, O_RDONLY, 0);
> + if (fd == -1) {
> + return -1;
> + }
> ret = fstatfs(fd, stbuf);
> close_preserve_errno(fd);
> return ret;
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-03-03 20:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-03 18:03 [Qemu-devel] [PATCH] 9pfs: fail local_statfs() earlier Greg Kurz
2017-03-03 18:13 ` Daniel P. Berrange
2017-03-03 18:15 ` Eric Blake
2017-03-03 20:00 ` Philippe Mathieu-Daudé
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.