From: Gerd Hoffmann <kraxel@redhat.com>
To: qemu-devel@nongnu.org
Cc: Marcel Apfelbaum <marcel.apfelbaum@gmail.com>,
Eduardo Habkost <ehabkost@redhat.com>,
Gerd Hoffmann <kraxel@redhat.com>, Li Qiang <liq3ea@163.com>
Subject: [Qemu-devel] [PULL 2/8] usb: dev-mtp: close fd in usb_mtp_object_readdir()
Date: Wed, 30 Jan 2019 08:34:20 +0100 [thread overview]
Message-ID: <20190130073426.11525-3-kraxel@redhat.com> (raw)
In-Reply-To: <20190130073426.11525-1-kraxel@redhat.com>
From: Li Qiang <liq3ea@163.com>
Spotted by Coverity: CID 1397070
Signed-off-by: Li Qiang <liq3ea@163.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20190103133113.49599-1-liq3ea@163.com
[ kraxel: dropped chunk which adds close() after successful
fdopendir() call, that is not needed according to
POSIX even though Coverity flags it as bug ]
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/usb/dev-mtp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c
index 68c5eb8eaa..837c9d9449 100644
--- a/hw/usb/dev-mtp.c
+++ b/hw/usb/dev-mtp.c
@@ -666,6 +666,7 @@ static void usb_mtp_object_readdir(MTPState *s, MTPObject *o)
}
dir = fdopendir(fd);
if (!dir) {
+ close(fd);
return;
}
#ifdef CONFIG_INOTIFY1
--
2.9.3
next prev parent reply other threads:[~2019-01-30 7:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-30 7:34 [Qemu-devel] [PULL 0/8] Usb 20190130 patches Gerd Hoffmann
2019-01-30 7:34 ` [Qemu-devel] [PULL 1/8] usb: assign unique serial numbers to hid devices Gerd Hoffmann
2019-05-17 16:54 ` Dr. David Alan Gilbert
2019-01-30 7:34 ` Gerd Hoffmann [this message]
2019-01-30 7:34 ` [Qemu-devel] [PULL 3/8] hw/usb: Fix LGPL information in the file headers Gerd Hoffmann
2019-01-30 7:34 ` [Qemu-devel] [PULL 4/8] usb: XHCI shall not halt isochronous endpoints Gerd Hoffmann
2019-01-30 7:34 ` [Qemu-devel] [PULL 5/8] usb: implement XHCI underrun/overrun events Gerd Hoffmann
2019-01-30 7:34 ` [Qemu-devel] [PULL 6/8] usb-mtp: Reallocate buffer in multiples of MTP_WRITE_BUF_SZ Gerd Hoffmann
2019-01-30 7:34 ` [Qemu-devel] [PULL 7/8] usb-mtp: breakup MTP write into smaller chunks Gerd Hoffmann
2019-02-14 18:52 ` Peter Maydell
2019-02-15 18:45 ` Bandan Das
2019-02-15 18:55 ` Peter Maydell
2019-02-15 19:22 ` Bandan Das
2019-01-30 7:34 ` [Qemu-devel] [PULL 8/8] usb-mtp: replace the homebrew write with qemu_write_full Gerd Hoffmann
2019-01-31 15:40 ` [Qemu-devel] [PULL 0/8] Usb 20190130 patches Peter Maydell
2019-01-31 18:10 ` no-reply
2019-02-02 21:26 ` no-reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190130073426.11525-3-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=ehabkost@redhat.com \
--cc=liq3ea@163.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).